Rails link to dynamic

Asked

Viewed 154 times

-1

I have the following question, in my controller has a variable that takes which model the guy is coming and sends to the view.

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

1 answer

0

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

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

Down here the path_origem has VALOR_DO_PATH_ORIGEM value, so you can go back to the source page.

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

Browser other questions tagged

You are not signed in. Login or sign up in order to post.