Thank's Sergio. That worked much better.

On Oct 19, 10:31 am, "Sergio Cambra .:: entreCables S.L. ::."
<[email protected]> wrote:
> I used it with index action, but I add some parameters to each action link. I
> have checked the code and you cannot have multiple action links to the same
> action and same parameters. It would be better to define a clone action:
>
> #routes
> resources :orders do
>   as_routes
>   get :clone, :on => :member
> end
>
> #controller
> def clone
>   @record = find_if_allowed(params[:id], :read)
>   @record = @record.clone
>   respond_to_action(:new)
> end
>
> On Miércoles, 19 de Octubre de 2011 17:12:54 JB escribió:
>
>
>
>
>
>
>
>
>
> > Nope. That doesn't work either. For now I just overrode the
> > _list_header.html.erb partial in my view.
>
> > On Oct 18, 2:36 am, "Sergio Cambra .:: entreCables S.L. ::."
>
> > <[email protected]> wrote:
> > > On Sábado, 8 de Octubre de 2011 21:38:06 JB escribió:
> > > > I've created a custom action link to clone records using this in my
> > > > controller:
>
> > > >   active_scaffold :order do |conf|
> > > >     conf.action_links.add 'new', :label => 'Clone', :type => :member
> > > >   end
>
> > > > I've also overriden the do_new controller method like this:
>
> > > >   def do_new
> > > >     @params_id = params[:id]
> > > >     if @params_id.present?
> > > >       @record = Order.find(@params_id)
> > > >       @record.clone
> > > >     else
> > > >       @record = Order.create
> > > >     end
> > > >   end
>
> > > > Everything works great except that the original Create New link at the
> > > > top of the form is gone. Any ideas on how I can get it back?
>
> > > Try setting another name to action link, like clone:
> > >     conf.action_links.add 'clone', :action => 'new', :label => 'Clone',
> > > :type => :member
>
> > > --
> > > Sergio Cambra .:: entreCables S.L. ::.
> > > Mariana Pineda 23, 50.018 Zaragoza
> > > T) 902 021 404 F) 976 52 98 07 E) [email protected]
>
> --
> Sergio Cambra .:: entreCables S.L. ::.
> Mariana Pineda 23, 50.018 Zaragoza
> T) 902 021 404 F) 976 52 98 07 E) [email protected]

-- 
You received this message because you are subscribed to the Google Groups 
"ActiveScaffold : Ruby on Rails plugin" 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/activescaffold?hl=en.

Reply via email to