I am learning about 'where' in Rails 3 and I am wondering why my code is giving me a NoMethod Error.
def create
#get form values from 'new' page
@post = Post.new(params[:post])
#search for the inventory item with the sku code the user typed in the form
@item = Inventory.where(:sku_code => @post.sku_code)
#set post variable to a variable from the row with the sku code
@post.detail = @item.detail
@post.save
end
By searching the SKU, I want to retrieve the other variables in the same id and set them to my @post variable. Anyone able to give me a hand?