In controller method i need to find some data, using like, so i write:
***
esupp = oo.cell(line,'N')
supplier = Supplier.where("SUP_BRAND like ?", "%#{esupp}%")
@aa = @art_concret.find{|item| item['ART_SUP_ID']==supplier.SUP_ID}
***
But i get error like
undefined method `SUP_ID' for #<ActiveRecord::Relation:0xa65048c>
When i tried to write Supplier.all all is good, bit i need like from sql. Supplier has data (see this in console), but when try to access field, get error
supplierisn’t the object you think it is – it’s a list of things you got back. If you’re expecting to only get oneSupplierback, do this instead: