If you need to refresh a part of a page in rails, sometimes we use link_to_remote (for replacing a partial file ), which is a remote link and when clicking on that link, it will call a AJAX method on controller and there we will replace the partial file. This is not the only solution for doing this, we can even do these kind of things without going to the controller methods (if no DB part is involved) link_to_remote & button_to_remote Just put this code on your view file 1. For just displaying an alert message button_to_function "Greeting", "alert('Hello world!')" (OR) link_to_function "Greeting", "alert('Hello world!')" 2. if u have to call a JS function after confirm box button_to_function "Delete", "if (confirm('Really?')) do_delete()" (OR) link_to_function "Delete", "if (confirm('Really?')) do_delete()" 3. For making visual effects, replacing partial, showing or hiding an html id element etc.., button_to_function "Details" do |page| page[:details].visual_effect :toggle_slide page[:details].replace_html "partial_file_name" page[:details].show page[:details].hide end (OR) link_to_function "Details" do |page| page[:details].visual_effect :toggle_slide page[:details].replace_html "partial_file_name" page[:details].show page[:details].hide end Note : Here 'details' is the div (0r) any html id element. "Details" is the link (or) button that is to be displayed on your view file. 4. We can also apply the class for the button. button_to_function "Details", :class => "details_button" do |page| page[:details].visual_effect :toggle_slide end