I'm just starting out in Ruby on Rails so sorry for the n00bish Q…
I want to make a button that triggers some javascript. I found this Q that lead me to writing the following code:
<%= button_to_function "Change Password", "$(this).toggle();", :class =>"password_div" %>
(Elsewhere, I have <div class="password_div" style="display: none;">…</div>
tags.)
The issue is that when I run this code I get the following error:
undefined method `button_to_function' for #<<Class:0x00000006abc1c8>:0x0000000647ee00>
Which I find confusing. My impression is that this comes standard in Rails (it is listed here along with lots of other methods that as far as I can tell are available immediately in RoR).
Do I need to make JavaScript Helper available somewhere? Or am I missing something somewhere else?