Dave Amos wrote:
Hi, I'm trying to do a custom method, but I get an undefined method
error. Here's what's happening:
<% @members.each do |member| %>
<td><%= member.user.name %></td>
<td><%= member.user.groupwide_score(@league) %></td>
<% end %>
Can I add the method groupwide_score() to member.user, or will Rails
think that I'm trying to find a column in the users table? Is there a
way to do this?
Simple answer is YES. Better answer is do you want to? The rest of the
thread seems to be debating the second part. To do the first:
belongs_to :user, :options_go_here do
#Go do that Voodoo that you do so well!
This is one of two ways to do exactly what you want. For more
and look in the "Association extensions" in the introduction.
You can also check out my slightly long post about them here: