I’ve renamed my .rhtml files to .html.erb and everything works fine.
Renaming .rjs to .js.rjs; however, does not. Pages don’t render unless
I specifically tell them to using render :template.
Any thoughts? Is the .js.rjs naming convention not quite ready yet?
Thanks,
Norman
Yes, you need the “respond_to do |format|” specified in your
controller. Prior to 2.0, rjs files worked without this. Now they
don’t, as far as I can tell.
-Kyle
Yes, js.rjs works just fine in Rails 2.0.2.
You must be missing something. I did a simple useless test to just
hide a div using RJS. Here how it looks:
routes.rb:
map.resources :offers, :collection => { :hide => :get }
offers_controller:
def hide
respond_to do |format|
format.js
end
end
hide.js.rjs:
page.hide “hide_me”
index.html.erb:
<%= link_to_remote "Hide Me", :url => { :action => 'hide' } %>
Some stuff to hide
application.html.erb:
Hello World
<%= javascript_include_tag :defaults %>
<%= yield %>