How to create a simple update link link with Ruby on Rails

I'm new to Ruby on rails, and I'm experimenting with the structure and functionality of RoR and want to know how to create a simple reload using RoR instead of the static HTML method.

+4
source share
4 answers
link_to "reload", url_for(params) 
+13
source

If you just make an empty string for the URL: <%= link_to "Refresh", "" %> , which will link to the current page. Assuming you want to clear the parameters.

If you want to update using the options, run the @bubblez command:

<%= link_to "Refresh", url_for(params) %> .

+3
source

Better save this with Javascript. Rails can help you in case you want to redirect.

0
source

I'm not quite sure why you just want to reload the page. (Maybe you need a little more context), but you could just create a link on the page that will reload it like this:

 <%= link_to "reload", root_path %> 

This will simply display a link to root_path, you can redirect back to any page you are currently on by changing the second parameter in hel_link. For a list of routes, do "rake routes."

0
source

Source: https://habr.com/ru/post/1501808/


All Articles