Randy
unread,Mar 5, 2009, 1:10:33 AM3/5/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message as abuse
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to resource_controller
Hi,
I'd like my /topics/ url to serve topics for the current user.
Primarily, it means:
* Fetch the collection/object relative to that current user
* Ensure that on create and update, the user hasn't tried to stuff the
topic into some other user's list
I was doing those with:
before_filter :fetch_topic, :except => [ :new, :create ]
before_filter :check_userid, :only => [ :create, :update ]
I'm now trying to switch to resource_controller, and I've defined
these methods to provide the parent object - so far, so good. The
fetch_topic() method is providing @user, btw, from
restful_authentication's current_user().
def parent_type
:user
end
def parent_object
@user
end
I'm suspecting that I need less of the before_filter stuff, but I'm
not sure how I cover the desired behavior without it - any help?
It's not clear to me that I've done everything I need to by defining
the two methods above. I would welcome any corrections on that or on
general stylistic recommendations.
Thanks,
Randy