> I could test for the presence of params[person_id] or
> params[contest_id], then execute and render accordingly within
> the :index action. But that seems somewhat inelegant.
How about writing something generic to get the parent? You
can add this at the bottom of your ScoresController for example:
private
def get_parent
params.each do |name, value|
return $1.classify.constantize.find(value) if name =~ /(.+)_id$/
end
nil
end
Have fun,
Franz
--
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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.