On 22 May 2014 14:47, Fab Forestier <li...@ruby-forum.com> wrote:
> Colin Law wrote in post #1146785:
>> I think so.  You can use button_to do invoke the action, and pass the
>> operation number as a parameter or in the url.  If you look at the
>> docs for button_to and google it to find more examples you will surely
>> find examples that meet your needs.
>>
>> Colin
>
> My matter is not how to pass the operation number to an other view but
> is how can I recover this number. Indeed my button is not linked with
> one operation...
> An exemple of what I want to do is the edit button of Articles index's
> view, on click we are redirected to the edit view with only the article
> of the line of the edit button clicked.

Just set the action on each button to the url that you want invoked,
so something like edit_article_path( article_ id ) where article_id is
the id of the article on that row.

Get it working just using link_to first, then make the link look like
a button if you want to.  Note that since the link is not actually
performing an operation, but is just taking you to a different page,
then you want a link not a form button.

Colin

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLtxfPF6u_uJZtxtWxDTHtFSaQiA8NddfwQrKoj_nuXCkQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to