ramya
ramya

Reputation: 928

what .js file required for supporting replace_html in controller

I am having page.replace_html with a partial in the controller. What is the correnponding .js file that i had to include to support this .

Thanks, Ramya.

Upvotes: 0

Views: 97

Answers (1)

Alok Swain
Alok Swain

Reputation: 6519

Assuming you are using Rails 2.3.x Prototype and its dependencies are already present in the framework. In you application you can include prototype.js specifically or use <%= javascript_include_tag :defaults %> which includes all the js files Rails provides, if application.js is there then that is included as well. PrototypeHelper in rails gives you the methods replace_html etc. If you use jquery instead of prototype then you would have to use jrails plugin.

In Rails 3 jQuery is present by default and jrails is not going to work. Rails 3 removed the the link between its Javascript helpers and Prototype, as unobtrusive way is recommended to do those things. However, you could user the Prototype Legacy Helper provided by Rails to get those methods.

Upvotes: 1

Related Questions