Hello all --
I''m new to the RoR, and have been enjoying learning about it. I have
a project that has gone through a couple of different frameworks/
languages (php, webobjects), and always gets hung up. I''ve made more
progress with Rails than anything else.
I have come across an issue that I can''t seem to figure out, though.
I have the following schema:
Tables
characters
attribs
name
attribs_characters
character_id
attrib_id
base
temp
skills
attrib_id
character_skills
character_id
skill_id
and relevant habtm and belongs_to joins.
What I would like to do is list the skills belonging to a particular
character. Each skill entry will also display the base and temp
values from the attribs_character table. I have an iteration going
through the skills easy enough. I can get the attribs list for a
character. What I am stumbling over is getting both. Here is my view
code:
<% for skill in @skills %>
<tr>
<td>
<%= link_to skill.name, :action =>
"show", :controller => "skill", :id => skill.id %>
</td>
<td>
<%= @character.attribs.find(skill.attrib_id).base %>
</td>
</tr>
<% end %>
I end up with the following error:
Couldn''t find Attrib with ID in (0)
for the line:
<%= @character.attribs.find(skill.attrib_id).base %>
What is odd is that if I hard-code a value, it works!
<%= @character.attribs.find(2).base %>
Can anyone shed any light on this? Any help greatly appreciated!
-Lucas
________________
Lucas Haley
lhaley-Qn9CpR9QR2k@public.gmane.org
http://www.pnca.edu/
503.821.8906