How to replace the old :nested action?

19 views
Skip to first unread message

Mihai

unread,
Nov 23, 2012, 12:07:37 PM11/23/12
to actives...@googlegroups.com
Hi there, 

We have upgrade from an old version of ActiveScaffold to the newest one that works with Rails 3.2.
And I'm unable to find a solution to how to replace the redirects that use the old nested action that is not existing anymore.

For example we have redirects like below that are used to redirect to an associations list of the current model.

redirect_to :action=>'nested',:id=>@record.id,:associations=>'images'
or
redirect_to :controller=>"admin_sale, :action=>'nested',
          :id=>img.owner_id,:associations=>'images',:extra_param=>"show_back_link:#{img.owner_type}"

Does someone knows how must be rewritten these redirects with the new ActiveScaffold?

thanks,
mihai

Hernan Astudillo

unread,
Nov 23, 2012, 4:05:19 PM11/23/12
to activescaffold
something like this? (i'm guessing your models and controllers)

:controller => 'images', :params => {:parent_scaffold => :admin_sale, :owner_id => img.owner_id, :association => 'images'}



--
You received this message because you are subscribed to the Google Groups "ActiveScaffold : Ruby on Rails plugin" group.
To view this discussion on the web visit https://groups.google.com/d/msg/activescaffold/-/71CPX5Qk0IsJ.
To post to this group, send email to actives...@googlegroups.com.
To unsubscribe from this group, send email to activescaffol...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/activescaffold?hl=en.

Mihai

unread,
Nov 23, 2012, 7:11:41 PM11/23/12
to actives...@googlegroups.com
After digging the AS code I have this that works:

redirect_to({:action=>'index',
                   :association => 'images',
                   :parent_scaffold => "admin_#{img.owner_type.downcase}",
                   :assoc_id => img.owner_id,
                   :"#{img.owner_type.downcase}_id" => img.owner_id,
                   :extra_param => "show_back_link:#{img.owner_type}"})

Is there any other more elegant way to do it?
Reply all
Reply to author
Forward
0 new messages