Here's the permission clause on my model:

  def view_permitted?(field)
    user_is?(acting_user) || acting_user.administrator?
  end


Problem is, when I'm not logged in, it bombs out with:

  undefined method `id' for guest:Guest


Grepping on user_is doesn't find a method definition.  I can't step
into it using a debugger.  Where on earth does user_is? come from??
Once I find it, I can fix it.


For now, I've worked around this like so:

  def view_permitted?(field)
    return false if acting_user.guest?
    user_is?(acting_user) || acting_user.administrator?
  end

No more crash but this seems strange, no?

    - Scott


Oh, if you're wondering why I'm getting an exception instead of the
typical "warning: Object#id will be deprecated; use Object#object_id"
warning in the logs, I turned them off by stuffing this in
config/environments/development.rb:

    Object.send(:undef_method, :id) if Object.respond_to?(:id)

Makes it much easier to see where I'm misusing objects.  It's all too
easy to accidentally use a plain array as if it were a collection of
models.

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