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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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:
<p><%= link_to_remote "Hide Me", :url => { :action =>
''hide'' } %></p>
<div id="hide_me">
Some stuff to hide
</div>
application.html.erb:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=utf-8"/>
<title>Hello World</title>
<%= javascript_include_tag :defaults %>
</head>
<body>
<%= yield %>
</body>
</html>
On May 8, 9:19 am, Norm
<normel...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> 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
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
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 On May 8, 10:06 pm, Robert Walker <r0b3rt4...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> 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: > <p><%= link_to_remote "Hide Me", :url => { :action => ''hide'' } %></p> > <div id="hide_me"> > Some stuff to hide > </div> > > application.html.erb: > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> > > <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> > <head> > <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> > <title>Hello World</title> > <%= javascript_include_tag :defaults %> > </head> > <body> > <%= yield %> > </body> > </html> > > On May 8, 9:19 am, Norm <normel...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > 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--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---