Reference to Prototype missing?

I added the following to a new.html.erb file:     <%= button_to_function "ShowList" do |page|     page[:vendor_droplist].toggle       end     %> I ran the Rails application and got consecutive popups:

Caption: RJS error: Body: ReferenceError: $ is not defined

Caption: The page at http://localhost:3000 says: Body: $(“vendor_droplist”).toggle

Could it be that a reference to Prototype is missing in the generated code? If so, where do it stick it at the Rails level so that it’s generated every time a test a new change?

I’m running Rails 2.3.5, Ruby 1.8.6, WinXP-Pro/SP3, Firefox 3.6.2, MySQL 5.0.37-community-nt, Mongrel

Thanks in Advance, Richard

After thinking about this problem a little more, I concluded that I needed in import prototype.js somehow. I originally thought that was automatic, and I'd like to make automatic.

Right now my problematic new.html.erb file in incorporated in the app by expenses.htmt.erb, which contains:   <%= stylesheet_link_tag 'scaffold' %>

So I think I need to add something like:         <%= javascript_link_tag "javascript" %>         <%= javascript_link_tag "prototype" %>         <%= script_link_tag "prototype" %>

Unfortunately, all my guesses were rejected by ERB. So I'm scouring my Ajax on Rails book and the web for an example. At the same time, I'd greatly appreciate whatever guidance anyone may care to offer.

Best wishes, Richard

Problem solved, finally (by Ajax on Rails, after adjustment to Rails my 2.3.5).

Solved by adding <%= javascript_include_tag :defaults %> to app\views\layouts\expenses.html.erb

I have skimmed Ajax on Rails many times, treating it as a reference- source rather that as a textbook. But today I stated a the beginning of the Prototype chapter and has a solution in minutes. Whew!