Are you getting this as an admin or a regular user? I typically end up adding new_record? to view_permitted to avoid problems where the record isn't set up when the permission is called, to avoid this kind of thing...

So you'd have:

def view_permitted?(field)
new_record? || acting_user.administrator? || acting_user.id == user_id
end

--Matt Jones

On Jun 9, 2010, at 7:09 PM, Steve Pallen wrote:

How do I trouble shoot this permission problem?

That operation is not allowed
Exception:
#<Hobo::PermissionDeniedError: Hobo::PermissionDeniedError>
params:
{"action"=>"new", "controller"=>"entries"}

Here is my model


class Entry < ActiveRecord::Base

  hobo_model # Don't put anything above this

  fields do
    name :string
    notes :text
    page  :string
    timestamps
  end

  belongs_to :reference
  belongs_to :user
  has_many   :scheduleds

  #TODO - Change this to show the user but not allow editing.
  #never_show  :user



  # --- Permissions --- #

  def create_permitted?
   # acting_user.signed_up?
   true
  end

  def update_permitted?
    acting_user.administrator? || acting_user.id == user_id
  end

  def destroy_permitted?
    acting_user.administrator? || acting_user.id == user_id
  end

  def view_permitted?(field)
    acting_user.administrator? || acting_user.id == user_id
  end

end

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

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