Thanks Matt - this is exactly what I wanted! Here's my final
definition of the controller for future reference:
class ActivitiesController < ApplicationController
hobo_model_controller
auto_actions :all
def index
hobo_index current_user.activities
end
end
On Jan 22, 12:25 pm, Matt Jones <[email protected]> wrote:
> On Jan 22, 2011, at 11:48 AM, Henry H wrote:
>
> > Okay I followed the examples and got a little further, but I'm not
> > able to figure out how to limit the index views to only the user who
> > owns those items. Am I supposed to define my own index function, use
> > the hobo_index command, and add a scoping filter to the controller? I
> > tried the following, but it didn't know who the acting user was...
>
> > def index
> > hobo_index(model,:conditions =>["user_id == ?",acting_user])
> > end
>
> > Can anyone post an example?
>
> In the controller, the user is available as current_user (acting_user is only
> available in permission methods). Assuming you've got a corresponding
> has_many (call it 'posts' for concreteness), your index action would look
> like:
>
> def index
> hobo_index currrent_user.posts
> end
>
> I'm thinking that this is a pattern that we should make more automated - sort
> of like auto_actions_for but for "owned" records. Thoughts on what to call it?
>
> --Matt Jones
--
You received this message because you are subscribed to the Google Groups "Hobo
Users" 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/hobousers?hl=en.