# New RJS naming convention

**URL:** <https://www.ruby-forum.com/t/new-rjs-naming-convention/137059>\
**Category:** Rails\
**Created:** [May 8, 2008, 4:48pm UTC](https://www.ruby-forum.com/t/new-rjs-naming-convention/137059 "2008-05-08T16:48:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![normelton](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/f1d935/32.png) [@normelton](https://www.ruby-forum.com/u/normelton)\
**Post date:** [May 8, 2008, 4:48pm UTC](https://www.ruby-forum.com/t/new-rjs-naming-convention/137059/1 "2008-05-08T16:48:51Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![normelton](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/f1d935/32.png) [@normelton](https://www.ruby-forum.com/u/normelton)\
**Post date:** [May 9, 2008, 7:04pm UTC](https://www.ruby-forum.com/t/new-rjs-naming-convention/137059/2 "2008-05-09T19:04:27Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![normelton](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/f1d935/32.png) [@normelton](https://www.ruby-forum.com/u/normelton)\
**Post date:** [May 9, 2008, 5:06am UTC](https://www.ruby-forum.com/t/new-rjs-naming-convention/137059/3 "2008-05-09T05:06:55Z")

</div>

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 %\>
