If you notice the original code, #view_permitted? always returns true.

Per Kevin's suggestion, I made #destroy_permitted? on the child return
true as well, and the <input-many/> appeared.

This was very unintuitive for me, and I guess I'll have to code my way
around it, something like this:

def destroy_permitted?
  new_record? || acting_user.administrator?
end

Thanks all for your help! I really appreciate.

Have a great day!
François

On 29 sep, 18:49, kevinpfromnm <[email protected]> wrote:
> honestly not sure, only thing left is destroy on the child (since
> input-many allows creating and destroying association records).  I
> can't cut through the hackery surrounding input-many's source to see
> where it's checking permissions and what permissions it checks.
>
> If that fails, set true on all permissions, both parent and child.
> that should confirm that it's a permissions issue.  then you can start
> adding back to see what's breaking it.
>
> On Sep 29, 3:46 pm, François Beausoleil
>
> <[email protected]> wrote:
> > I changed my #update_permitted? on the child to be:
>
> > def update_permitted?
> >   acting_user.signed_up?
> > end
>
> > No change. I tried returning true from both #create_permitted? and
> > #update_permitted? on the parent and child: no change.
>
> > Thanks for the tip. Any other ideas?
> > François
>
> > On 29 sep, 14:31, kevinpfromnm <[email protected]> wrote:
>
> > > would guess that your problem is in the update permission on the
> > > child.  I would think it's choking on updating the existing belongs_to
> > > association and thus not rendering that part of the form.  Hard to say
> > > for sure, but that'd be my take on it.
>
> > > On Sep 29, 7:58 am, François Beausoleil
>
> > > <[email protected]> wrote:
> > > > Hi all!
>
> > > > I need help with the permission system. I can't make heads or tails of
> > > > it when using it in conjunction with child models.
>
> > > > The short version: when logged in as an admin, creating a model with
> > > > children works just fine. When I login as a user with administrator =>
> > > > false, I don't get the <input-many/>, even though I use #user_new and
> > > > create_permitted? returns true, always.
>
> > > > The long version...  Code athttp://gist.github.com/602767
>
> > > > In the pasted version, I have the code I really want to use, but if I
> > > > change the #create_permitted? methods to return true, the result is
> > > > the same. Removing the implementation of
> > > > KioskTransactionsController#new changes nothing - the lines aren't
> > > > displayed, and I can't use the +/- buttons. It's as if associations
> > > > weren't present when I'm not an admin. I also tried using #user_new
> > > > from KioskTransaction#initialize_with_no_consignment, to no avail.
>
> > > > I read the "The Permission System - associations" section of the
> > > > manual very carefully. I searched this group. I asked the great Google
> > > > (which led me to the manual). Nothing in the agility tutorial stroke
> > > > me as the answer to my question.
>
> > > > Again, I repeat: with no changes except logging in as an admin,
> > > > everything works. What am I missing?
>
> > > > Thanks!
> > > > François

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