Rails link to dynamic

0

I have the following question, in my controller there is a variable that picks which model the guy is coming from and sends it to the view.

I would like to create a link from this variable type: link_to @link (variable: @variavel), in this part the system is very dynamic and I would like to be able to show a link back to the template that would have invoked the creation.     

asked by anonymous 29.07.2017 / 23:24

1 answer

0

In the example below I'm sending the source path to the next page, you can do this using partial with the locals .

<%= render partial: 'form', locals: {path_origem: 'VALOR_DO_PATH_ORIGEM'} %>

Here below the path_origem has the value VALUE_DO_PATH_ORIGEM, this way you can go back to the source page.

<%= f.submit 'voltando', path_origem %>

    
31.07.2017 / 19:29