On Jan 22, 2011, at 4:42 PM, kevinpfromnm wrote:
> well, if you make your ownership association owner, then you can do
> auto_actions_for :owner
The biggest issue (of sorts) that I see with this is that it breaks the
automatic Hobo linking stuff, which is looking for a plain index path. One idea
would be to implement a controller-level declaration that would (effectively)
make the controller look like this:
class PostsController < ApplicationController
hobo_model_controller
auto_actions :all
def index
hobo_index current_user.posts
end
def show
hobo_show current_user.posts.find(params[:id])
end
def edit
hobo_edit current_user.posts.find(params[:id])
end
...etc for the other CRUD actions...
end
Here's a question: would it be more useful to have this exact behavior, or a
more generalized framework that can start the search with an arbitrary scope?
Resource_controller's end_of_association_chain method can be used in that
fashion; the Hobo equivalent would be replacing 'current_user.posts' with an
arbitrary expression in the above example. One might, for instance, want to
change that to:
current_user.posts.active
where active is:
named_scope :active, :conditions => { :active => true }
This has some neat side-effects (posts will always be created with active set,
unless the form explicitly sends a 0 value), and could be useful.
--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.