I have an admin section in my rails 3 app. where I want to use a different layout than the main layouts/application.html.haml layout. Here is the snippet of the admin_controller.rb: class AdminController < ApplicationController current_section :admin layout :admin . . end Here are the contents of the layouts/admin.html.haml file: - content_for :secondary_nav do = navigation :second_level_admin = render :file => "layouts/application" Rails 3 is ignoring the admin layout all-together. Rails 2.3.8 doesn''t. Is there an existing bug in Rails 3? Bharat -- Posted via http://www.ruby-forum.com/. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
I think it should be layout "admin" . For some reason symbols in the layout doesn''t work. On 26 Αύγ, 06:22, Bharat Ruparel <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> I have an admin section in my rails 3 app. where I want to use a > different layout than the main layouts/application.html.haml layout. > Here is the snippet of the admin_controller.rb: > > class AdminController < ApplicationController > > current_section :admin > layout :admin > . > . > end > > Here are the contents of the layouts/admin.html.haml file: > > - content_for :secondary_nav do > > = navigation :second_level_admin > > = render :file => "layouts/application" > > Rails 3 is ignoring the admin layout all-together. Rails 2.3.8 doesn''t. > Is there an existing bug in Rails 3? > > Bharat > -- > Posted viahttp://www.ruby-forum.com/.-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
Hello Johndel, Thanks for your response. Unfortunately, it did not work. I typed in layout "admin" instead of layout :admin Still. No luck. Bharat -- Posted via http://www.ruby-forum.com/. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hi, I''ve just started my first Rails 3 stable app from scratch and still looking at all the changes. Most things are wonderful. However, I can''t figure out what happened to the layout structure. In my controller: class ApplicationController < ActionController::Base protect_from_forgery layout ''application'' end And in app/views/layouts/application.html.erb: <html> <head> ... </head> <body> ... <%= yield %> ... </body> </html> This is the way I did it in Rails 2.3.x. I can''t find what''s changed in Rails 3.0. All my actions are showing up without the layout. Thanks. Jaap Haagmans -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Sep 7, 5:51 pm, jhaagmans <jaap.haagm...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi, > > I''ve just started my first Rails 3 stable app from scratch and still > looking at all the changes. Most things are wonderful. However, I > can''t figure out what happened to the layout structure. > > In my controller: > > class ApplicationController < ActionController::Base > protect_from_forgery > > layout ''application'' > end > > And in app/views/layouts/application.html.erb: > > <html> > <head> > ... > </head> > <body> > ... > <%= yield %> > ... > </body> > </html> > > This is the way I did it in Rails 2.3.x. I can''t find what''s changed > in Rails 3.0. All my actions are showing up without the layout.Make sure you don''t have two application.* files in the layouts directory. If for example you have: layouts/application.html layouts/application.html.erb It will render the .html.erb first. Also, look at the log to see what they say. Did your old application.html.erb get renamed during the upgrade? Anyway, hope this helps. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
Hi James, Thanks for your thinking with me. I haven''t upgraded from Rails 2.3.x, I''ve started a new Rails 3 application and edited the generated application.html.erb. I''ve also tried creating a new one called main.html.erb and pointing to that in my ApplicationController, but that didn''t work as well. The logs show nothing weird: Started GET "/user_sessions/new" for 127.0.0.1 at Wed Sep 08 11:14:27 +0200 2010 SQL (0.4ms) SHOW TABLES Processing by UserSessionsController#new as HTML Rendered user_sessions/new.html.erb (7.0ms) Completed 200 OK in 70ms (Views: 20.2ms | ActiveRecord: 0.4ms) Thanks again. Jaap Haagmans On Sep 8, 3:47 am, james <ja...-7AKS9a5XQeOw5LPnMra/2Q@public.gmane.org> wrote:> On Sep 7, 5:51 pm, jhaagmans <jaap.haagm...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > Hi, > > > I''ve just started my first Rails 3 stable app from scratch and still > > looking at all the changes. Most things are wonderful. However, I > > can''t figure out what happened to the layout structure. > > > In my controller: > > > class ApplicationController < ActionController::Base > > protect_from_forgery > > > layout ''application'' > > end > > > And in app/views/layouts/application.html.erb: > > > <html> > > <head> > > ... > > </head> > > <body> > > ... > > <%= yield %> > > ... > > </body> > > </html> > > > This is the way I did it in Rails 2.3.x. I can''t find what''s changed > > in Rails 3.0. All my actions are showing up without the layout. > > Make sure you don''t have two application.* files in the layouts > directory. If for example you have: > > layouts/application.html > layouts/application.html.erb > > It will render the .html.erb first. > > Also, look at the log to see what they say. Did your old > application.html.erb get renamed during the upgrade? > > Anyway, hope this helps.-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
Jaap Haagmans wrote:> In my controller: > > class ApplicationController < ActionController::Base > protect_from_forgery > > layout ''application'' > end >Yank the layout ''application'' statement and you should be fine. My out-of-the-generator Rails 3 app honors the application.html.erb without any such statement. class ApplicationController < ActionController::Base protect_from_forgery end -- Posted via http://www.ruby-forum.com/. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hi Ar, Thanks! I added that statement because my layout wouldn''t show. So with or without it, it makes no difference. Regards, Jaap Haagmans On Sep 8, 6:01 pm, Ar Chron <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Jaap Haagmans wrote: > > In my controller: > > > class ApplicationController < ActionController::Base > > protect_from_forgery > > > layout ''application'' > > end > > Yank the > > layout ''application'' > > statement and you should be fine. My out-of-the-generator Rails 3 app > honors the application.html.erb without any such statement. > > class ApplicationController < ActionController::Base > protect_from_forgery > end > -- > Posted viahttp://www.ruby-forum.com/.-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.