What does type error mean? I am reading a value from a table with a SELECT statement and using that value to pass on to a method.
a = Item.select("value").where("item.value LIKE :posted_data",{:posted_data => params[:posted_data]})
@h = Issue.ask(xyz, abc, a[:value])
TypeError (can’t convert Symbol into Integer):
I tried a, a[:value], a[:value].to_s. all didn’t work.
puts a.to_s
#<ActiveRecord::Relation:0xa898ba4>
Use:
a.first[:value]It is because ‘a’ is a relation in this case, it can contain multiple items.