1) I get Rails Application Error when trying to use layout test_controller def list layout "stdlayout" end in the views/test/layouts stdlayout.rhtml <html> <head><title>test</title></head> </body> <h1>Test</h1> <%= content_for_layout %> </body> </html> 2) I get Rails Application Error when trying to use a separate display page I create a method in the test_controller def welcome end in test/views I create an html page called welcome.rhtml what am I missing ? thanks.
Derek Haynes
2005-Dec-31 20:54 UTC
[Rails] Application Errors w/ layout & custom view pages
John, I believe you want to use <%= @content_for_layout %> and not ''content_for_layout.'' I also believe the method #layout is a class method that shouldn''t be placed inside an action: class TestController layout ''stdlayout'' ... actions go here... If you want to have a specific layout for an action, try (for the API): def help render :action => "help/index", :layout => "help" end - Derek On 12/31/05, John Taber <jtaber@johntaber.net> wrote:> 1) I get Rails Application Error when trying to use layout > > test_controller > def list > layout "stdlayout" > end > > in the views/test/layouts stdlayout.rhtml > <html> > <head><title>test</title></head> > </body> > <h1>Test</h1> > <%= content_for_layout %> > </body> > </html> > > 2) I get Rails Application Error when trying to use a separate display page > > I create a method in the test_controller > def welcome > end > > in test/views I create an html page called welcome.rhtml > > what am I missing ? thanks. > > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Derek Haynes HighGroove Studios - http://www.highgroove.com Atlanta, GA Keeping it Simple. 404.593.4879
Thanks, but neither the layouts or custom html pages are working - still getting application errors (vers. 1.0 and ruby 1.8.3 ubuntu). Something seems really wrong not to be able to do these things after spending hours with it. I''m either really missing something or maybe rails is still too fragile/inflexible for our needs at this point. Derek Haynes wrote:> John, > > I believe you want to use <%= @content_for_layout %> and not > ''content_for_layout.'' > > I also believe the method #layout is a class method that shouldn''t be > placed inside an action: > > class TestController > layout ''stdlayout'' > ... > actions go here... > > If you want to have a specific layout for an action, try (for the API): > > def help > render :action => "help/index", :layout => "help" > end > > - Derek > > On 12/31/05, John Taber <jtaber@johntaber.net> wrote: > >>1) I get Rails Application Error when trying to use layout >> >>test_controller >>def list >> layout "stdlayout" >>end >> >>in the views/test/layouts stdlayout.rhtml >><html> >><head><title>test</title></head> >></body> >><h1>Test</h1> >><%= content_for_layout %> >></body> >></html> >> >>2) I get Rails Application Error when trying to use a separate display page >> >>I create a method in the test_controller >>def welcome >>end >> >>in test/views I create an html page called welcome.rhtml >> >>what am I missing ? thanks. >> >> >> >>_______________________________________________ >>Rails mailing list >>Rails@lists.rubyonrails.org >>http://lists.rubyonrails.org/mailman/listinfo/rails >> > > > > -- > Derek Haynes > HighGroove Studios - http://www.highgroove.com > Atlanta, GA > Keeping it Simple. > 404.593.4879 > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > >
Derek Haynes
2005-Dec-31 23:57 UTC
[Rails] Application Errors w/ layout & custom view pages
What is the trace of the ApplicationError? Without that, it''s pretty tough to figure out what''s wrong. - Derek On 12/31/05, John Taber <jtaber@johntaber.net> wrote:> Thanks, but neither the layouts or custom html pages are working - still > getting application errors (vers. 1.0 and ruby 1.8.3 ubuntu). Something > seems really wrong not to be able to do these things after spending > hours with it. I''m either really missing something or maybe rails is > still too fragile/inflexible for our needs at this point. > > Derek Haynes wrote: > > John, > > > > I believe you want to use <%= @content_for_layout %> and not > > ''content_for_layout.'' > > > > I also believe the method #layout is a class method that shouldn''t be > > placed inside an action: > > > > class TestController > > layout ''stdlayout'' > > ... > > actions go here... > > > > If you want to have a specific layout for an action, try (for the API): > > > > def help > > render :action => "help/index", :layout => "help" > > end > > > > - Derek > > > > On 12/31/05, John Taber <jtaber@johntaber.net> wrote: > > > >>1) I get Rails Application Error when trying to use layout > >> > >>test_controller > >>def list > >> layout "stdlayout" > >>end > >> > >>in the views/test/layouts stdlayout.rhtml > >><html> > >><head><title>test</title></head> > >></body> > >><h1>Test</h1> > >><%= content_for_layout %> > >></body> > >></html> > >> > >>2) I get Rails Application Error when trying to use a separate display page > >> > >>I create a method in the test_controller > >>def welcome > >>end > >> > >>in test/views I create an html page called welcome.rhtml > >> > >>what am I missing ? thanks. > >> > >> > >> > >>_______________________________________________ > >>Rails mailing list > >>Rails@lists.rubyonrails.org > >>http://lists.rubyonrails.org/mailman/listinfo/rails > >> > > > > > > > > -- > > Derek Haynes > > HighGroove Studios - http://www.highgroove.com > > Atlanta, GA > > Keeping it Simple. > > 404.593.4879 > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Derek Haynes HighGroove Studios - http://www.highgroove.com Atlanta, GA Keeping it Simple. 404.593.4879
Steven Smith
2006-Jan-01 02:29 UTC
[Rails] Application Errors w/ layout & custom view pages
In the case of 1) the layout should be in app>views>layouts, not app>views>test>layouts and as pointed out in another reply, layout should be at the class level, not inside a method and you want @content_for_layout not content_for_layout. For 2), what error are you getting specifically? What''s in your development.log? On Dec 31, 2005, at 2:38 PM, John Taber wrote:> 1) I get Rails Application Error when trying to use layout > > test_controller > def list > layout "stdlayout" > end > > in the views/test/layouts stdlayout.rhtml > <html> > <head><title>test</title></head> > </body> > <h1>Test</h1> > <%= content_for_layout %> > </body> > </html> > > 2) I get Rails Application Error when trying to use a separate > display page > > I create a method in the test_controller > def welcome > end > > in test/views I create an html page called welcome.rhtml > > what am I missing ? thanks. > > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails
Thanks all for suggestions. Actually the layout is in views/layouts - I just mistyped in email. I have shown vital info & log below. The default scaffold list without layout works fine. I get similar error when trying to use a separate/custom page (ie welcome, help, ... etc) beyond the standard scaffold stuff. And I cannot find any examples of such. class AgenciesController < ApplicationController layout ''stdlayout'' def index list render :action => ''list'' end def list @agency_pages, @agencies = paginate :agencies, :per_page => 10 end .../app/views/layouts/stdlayout.rhtml <html> <head><title>test</title> </head> <body> <h1>login screen</h1> <%= @content_for_layout %> </body> </html> Processing AgenciesController#index (for 127.0.0.1 at 2005-12-31 15:59:08) [GET] Parameters: {"action"=>"index", "controller"=>"agencies"} [4;36;1mAgency Count (0.001912) [0;1mSELECT COUNT(*) FROM agencies [4;35;1mAgency Load (0.000740) SELECT * FROM agencies LIMIT 10 OFFSET 0 Rendering actionlistlayoutfalse within layouts/stdlayout Rendering agencies/list [4;36;1mSQL (0.004213) [0;1m SELECT a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, a.attnotnull FROM pg_attribute a LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum WHERE a.attrelid = ''agencies''::regclass AND a.attnum > 0 AND NOT a.attisdropped ORDER BY a.attnum Steven Smith wrote:> In the case of 1) the layout should be in app>views>layouts, not > app>views>test>layouts and as pointed out in another reply, layout > should be at the class level, not inside a method and you want > @content_for_layout not content_for_layout. For 2), what error are you > getting specifically? What''s in your development.log?> > On Dec 31, 2005, at 2:38 PM, John Taber wrote: > >> 1) I get Rails Application Error when trying to use layout >> >> test_controller >> def list >> layout "stdlayout" >> end >> >> in the views/test/layouts stdlayout.rhtml >> <html> >> <head><title>test</title></head> >> </body> >> <h1>Test</h1> >> <%= content_for_layout %> >> </body> >> </html> >> >> 2) I get Rails Application Error when trying to use a separate >> display page >> >> I create a method in the test_controller >> def welcome >> end >> >> in test/views I create an html page called welcome.rhtml >> >> what am I missing ? thanks. >> >> >> >> _______________________________________________ >> Rails mailing list >> Rails@lists.rubyonrails.org >> http://lists.rubyonrails.org/mailman/listinfo/rails > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > >
Steven Smith
2006-Jan-01 21:09 UTC
[Rails] Application Errors w/ layout & custom view pages
What are the names of your models / tables used with this controller / action? Thanks. On Jan 1, 2006, at 5:13 AM, John Taber wrote:> Thanks all for suggestions. Actually the layout is in views/ > layouts - I just mistyped in email. I have shown vital info & log > below. The default scaffold list without layout works fine. I get > similar error when trying to use a separate/custom page (ie > welcome, help, ... etc) beyond the standard scaffold stuff. And I > cannot find any examples of such. > > class AgenciesController < ApplicationController > layout ''stdlayout'' > > def index > list > render :action => ''list'' > end > def list > @agency_pages, @agencies = paginate :agencies, :per_page => 10 > end > > .../app/views/layouts/stdlayout.rhtml > <html> > <head><title>test</title> > </head> > <body> > <h1>login screen</h1> > <%= @content_for_layout %> > </body> > </html> > > Processing AgenciesController#index (for 127.0.0.1 at 2005-12-31 > 15:59:08) [GET] > Parameters: {"action"=>"index", "controller"=>"agencies"} > [4;36;1mAgency Count (0.001912) [0;1mSELECT COUNT(*) FROM > agencies > [4;35;1mAgency Load (0.000740) SELECT * FROM agencies > LIMIT 10 OFFSET 0 > Rendering actionlistlayoutfalse within layouts/stdlayout > Rendering agencies/list > [4;36;1mSQL (0.004213) [0;1m SELECT a.attname, format_type > (a.atttypid, a.atttypmod), d.adsrc, a.attnotnull > FROM pg_attribute a LEFT JOIN pg_attrdef d > ON a.attrelid = d.adrelid AND a.attnum = d.adnum > WHERE a.attrelid = ''agencies''::regclass > AND a.attnum > 0 AND NOT a.attisdropped > ORDER BY a.attnum > > > Steven Smith wrote: >> In the case of 1) the layout should be in app>views>layouts, not >> app>views>test>layouts and as pointed out in another reply, >> layout should be at the class level, not inside a method and you >> want @content_for_layout not content_for_layout. For 2), what >> error are you getting specifically? What''s in your development.log? > >> On Dec 31, 2005, at 2:38 PM, John Taber wrote: >>> 1) I get Rails Application Error when trying to use layout >>> >>> test_controller >>> def list >>> layout "stdlayout" >>> end >>> >>> in the views/test/layouts stdlayout.rhtml >>> <html> >>> <head><title>test</title></head> >>> </body> >>> <h1>Test</h1> >>> <%= content_for_layout %> >>> </body> >>> </html> >>> >>> 2) I get Rails Application Error when trying to use a separate >>> display page >>> >>> I create a method in the test_controller >>> def welcome >>> end >>> >>> in test/views I create an html page called welcome.rhtml >>> >>> what am I missing ? thanks. >>> >>> >>> >>> _______________________________________________ >>> Rails mailing list >>> Rails@lists.rubyonrails.org >>> http://lists.rubyonrails.org/mailman/listinfo/rails >> _______________________________________________ >> Rails mailing list >> Rails@lists.rubyonrails.org >> http://lists.rubyonrails.org/mailman/listinfo/rails > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails
Steven Smith wrote:> What are the names of your models / tables used with this controller / > action?table: agencies model: agency.rb (class Agency)> > Thanks. > > On Jan 1, 2006, at 5:13 AM, John Taber wrote: > >> Thanks all for suggestions. Actually the layout is in views/ layouts >> - I just mistyped in email. I have shown vital info & log below. >> The default scaffold list without layout works fine. I get similar >> error when trying to use a separate/custom page (ie welcome, help, >> ... etc) beyond the standard scaffold stuff. And I cannot find any >> examples of such. >> >> class AgenciesController < ApplicationController >> layout ''stdlayout'' >> >> def index >> list >> render :action => ''list'' >> end >> def list >> @agency_pages, @agencies = paginate :agencies, :per_page => 10 >> end >> >> .../app/views/layouts/stdlayout.rhtml >> <html> >> <head><title>test</title> >> </head> >> <body> >> <h1>login screen</h1> >> <%= @content_for_layout %> >> </body> >> </html> >> >> Processing AgenciesController#index (for 127.0.0.1 at 2005-12-31 >> 15:59:08) [GET] >> Parameters: {"action"=>"index", "controller"=>"agencies"} >> [4;36;1mAgency Count (0.001912) [0;1mSELECT COUNT(*) FROM >> agencies >> [4;35;1mAgency Load (0.000740) SELECT * FROM agencies >> LIMIT 10 OFFSET 0 >> Rendering actionlistlayoutfalse within layouts/stdlayout >> Rendering agencies/list >> [4;36;1mSQL (0.004213) [0;1m SELECT a.attname, format_type >> (a.atttypid, a.atttypmod), d.adsrc, a.attnotnull >> FROM pg_attribute a LEFT JOIN pg_attrdef d >> ON a.attrelid = d.adrelid AND a.attnum = d.adnum >> WHERE a.attrelid = ''agencies''::regclass >> AND a.attnum > 0 AND NOT a.attisdropped >> ORDER BY a.attnum >> >> >> Steven Smith wrote: >> >>> In the case of 1) the layout should be in app>views>layouts, not >>> app>views>test>layouts and as pointed out in another reply, layout >>> should be at the class level, not inside a method and you want >>> @content_for_layout not content_for_layout. For 2), what error are >>> you getting specifically? What''s in your development.log? >> >> >>> On Dec 31, 2005, at 2:38 PM, John Taber wrote: >>> >>>> 1) I get Rails Application Error when trying to use layout >>>> >>>> test_controller >>>> def list >>>> layout "stdlayout" >>>> end >>>> >>>> in the views/test/layouts stdlayout.rhtml >>>> <html> >>>> <head><title>test</title></head> >>>> </body> >>>> <h1>Test</h1> >>>> <%= content_for_layout %> >>>> </body> >>>> </html> >>>> >>>> 2) I get Rails Application Error when trying to use a separate >>>> display page >>>> >>>> I create a method in the test_controller >>>> def welcome >>>> end >>>> >>>> in test/views I create an html page called welcome.rhtml >>>> >>>> what am I missing ? thanks. >>>> >>>> >>>> >>>> _______________________________________________ >>>> Rails mailing list >>>> Rails@lists.rubyonrails.org >>>> http://lists.rubyonrails.org/mailman/listinfo/rails >>> >>> _______________________________________________ >>> Rails mailing list >>> Rails@lists.rubyonrails.org >>> http://lists.rubyonrails.org/mailman/listinfo/rails >> >> _______________________________________________ >> Rails mailing list >> Rails@lists.rubyonrails.org >> http://lists.rubyonrails.org/mailman/listinfo/rails > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > >