Can someone please tell me how to access the array that would be in @brand_found (below).
I have tried @brand_found.id, @brand_found[:id], @brand_found_id… nothing seems to work.
@brand_found = Brand.where("name = ?", params[:brand])
I would like to pass the id found to the session.
Thanks!
As you said, it’s an Array, and an Array doesn’t have any id.
You should iterate its elements
It will store the ids in
session[:brand_0],session[:brand_1]etc…Otherwise, take the first element and store it’s id directly, just append
.first