Hi all, I'm ashamed to ask this but I can't figure it out. Lately my brain gets more burned out by the minute. Basically I'm trying to have a shirt have up to 2 colors. I currently have this working. When I edit a shirt, I can select the primary and secondary color of a shirt. But when I want to see the colors in the show page I can't manage to see the name only the id.
For example: <b>Primary Color:</b> <%=h @shirt.color_id %><br /> <b>Secondary Color:</b> <%=h @shirt.color2_id %><br /> Only displays the id (obviously) but what I want to see is the NAME OF THE COLOR. I just can't think of a way to do this for some reason. Maybe there is a better way to do this and you guys can shed a light? Below is the database structure and model relationship code... APPROVED_COLORS (table name/structure in db) ------- :id (int) :name (string) SHIRTS (table name/structure in db) ------- :color_id (int) :color2_id (int) APPROVED_COLOR.RB -------- belongs_to :shirt SHIRT.RB ---------- has_many :approved_colors Any help on this is greatly appreciated. Thanks, Tony -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---