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.
Greg B. (Guest)
on 2017-02-07 22:20
Attachment: schema.rb (0 Bytes)
Attachment: line_items_index.html.erb (0 Bytes)
Attachment: line_items_controller.rb (0 Bytes)
Attachment: line_item.rb (0 Bytes)
Attachment: recipe.rb (0 Bytes)
Attachment: ingredient.rb (0 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.