Forum: Ruby on Rails Variable.attribute returns object Class, possible association problem

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
060d930be978a8c7bb73f43fea6b1dd1?d=identicon&s=25 Greg B. (gregb)
on 2017-02-07 21:20
Attachment: schema.rb (3 KB)
Attachment: line_items_index.html.erb (693 Bytes)
Attachment: line_items_controller.rb (3 KB)
Attachment: line_item.rb (458 Bytes)
Attachment: recipe.rb (874 Bytes)
Attachment: ingredient.rb (62 Bytes)
I have a cookbook app that allows users to save their favorite recipes
and on their profile page they can get a randomized weekly menu based on
their favorite recipes.

 I am trying to be able to print out the ingredients of the weekly menu,
but so far I can’t get it to print the name of the ingredient.
Currently when I try something like:

The result is “Ingredient”.

I suspect that it might have something to do with associations, but I
can’t figure it out.  Any help would be greatly appreciated.
This topic is locked and can not be replied to.