On Apr 7, 2010, at 9:25 AM, Bryan Larsen wrote:

This is what owner associations were designed to handle. Tutorial here:
http://cookbook.hobocentral.net/tutorials/agility#project-belongs-to-user

Bryan

I think the original post was looking for a stronger level of user isolation - in other words, having /projects show *just* the users projects, with no overlap. The DRYest way I can think of to handle this goes back to resource_controller, one of Hobo's early inspirations.

Redefining 'model' on the controller should work:

class TasksController < ApplicationController
  hobo_model_controller

  auto_actions :all

  def model
    current_user.administrator? ? Task : current_user.tasks
  end
end

(the administrator check is just an example; not sure if the OP's app will need it) This *should* work, since calls like 'model.user_find' and the like will proxy back through the association.

Hope this helps!

--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.

Reply via email to