I have an activeadmin resource that has own_to: user relationship.
When I create a new instance of the model in the active admin, I want to associate the registered user as the user who created the instance (quite standard material that I would imagine).
So ... I got it with:
controller do def create @item = Item.new(params[:item]) @item.user = current_curator super end end
However;) I'm just wondering how this works? I just hoped that assigning the @item variable to the user and then calling super would work (and that would happen). I also began to study the gem, but could not understand how it works.
Any pointers would be great. I assume this is what InheritedResources gives you?
Thank!
ruby-on-rails activeadmin inherited-resources
patrick-davey Dec 03 '12 at 1:01 2012-12-03 01:01
source share