Hi all,
Since my commentable resources are not too many, I decided to do
something like this in the comment controller:
before_filter: find_resource
private
def find_resource
if params[:article_id]
@resource = Article.find(params[:article_id])
elsif params[:photo_id]
@resource = Photo.find(params[:article_id])
end
end
Thank y'all,
Difei
--
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 [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
-~----------~----~----~----~------~----~------~--~---