add a exception for new_record?

I've been using early termination for permissions more lately as it's
usually clearer when you get more than 2-3 boolean terms, so:

def create_permitted?
  return false unless acting_user.administrator?
  return true if new_record?
  !items.empty?
end

On Nov 9, 1:29 pm, Peter Ehrlich <[email protected]> wrote:
> Hello!
>
> I like the permissions system a lot, its pretty cool.  Edit_permitted
> makes sense.  Why is there no new_permitted?
>
> For example, suppose I want to make it illegal to create a new record
> (with the permissions system) which is devoid of associated items.  It
> might look something like this:
>
> def create_permitted?
>     acting_user.administrator? && !items.empty?
>   end
>
> However, of course, the form is no longer displayed, because items
> don't exist yet.
>
> Solution?  Go in to the do_create action? Patch hobo core? (How easy
> or good would that be?)
>
> --Peter

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