View permission is checked as well for any action. You either need your new model to belong to the owner right away or add an exception for new_record? in your view permitted method. The exception is the easier to implement in most cases.
Also, on a side note, you probably want to add :creator => true to your belongs_to association so that hobo will handle assigning current user as the owner. On Oct 13, 6:13 am, LadyBug <[email protected]> wrote: > I have a problem where clicking on a "New project" link in my test app > fails with <Hobo::PermissionDeniedError: Hobo::PermissionDeniedError> > params: {"action"=>"new", "controller"=>"projects"} > > My Project model has: > > belongs_to :owner, :class_name => "User", :foreign_key => 'user_id' > > def create_permitted? > true > end > > def update_permitted? > owner_is? acting_user > end > > def destroy_permitted? > owner_is? acting_user > end > > def view_permitted?(field) > owner_is? acting_user > end > <pre> > and the User model has the corresponding has_many link. > My ProjectsController is in its entirety: > > class ProjectsController < ApplicationController > > hobo_model_controller > > # TODO: If I select auto_actions_for owner, I get blank pages > #auto_actions_for :owner, [:index, :new, :create] > auto_actions :all > > end > > Now, I am logged in as an administrator user, who owns 1 existing > project, which I have created earlier. Just now I played with the > ownership issue and auto_actions_for. Now viewing and editing the > existing project work just fine, but creating a new project fails. > Creating a new project also fails with a non-admin account. > > What gives? As far as I can see, the permissions in the model are > correct. Is there some hidden magic in the hobo_model_controller? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
