where to invoke “layout”? AppllicationController or ChildController?

these days i am having a lot of fun with Ruby on Rails. it seems to be like an open ground with lot of handful tools, now come up with ideas and build them up.

handful ruby based tools really helping me to let my smile back. anyway, while i was writing code on rails i am feeling something can be better practice something is not good. from now on, i will try to put them over the my blog.

their is method called “layout” which is used to define the based layout for the controller. this can be used from ApplicationController and other domain specific controller for example : “UserController”.

my team and me was used to define layout over the domain specific controller, but i belief, as we are repeating same “layout ‘template1′” code over and over, it must be better to keep inside the ApplicationController, as because all domain specific controllers are extending application controller, more over it is easy to change.

you may get a question about ajax based response, the better answer is, use render .., layout => false, that will get rid of base layout.

best wishes,

Advertisements

2 responses to “where to invoke “layout”? AppllicationController or ChildController?

  1. I have it running on my computer right now after you asked me if I had it. Just pleying around with it on the moment, and I must say its great to work with…

    Man, I have been learnig quite a lot because of you…

  2. hi,
    i belief you will find it interesting and great things to play around 🙂

    wish your better ride on rails

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

my tweets

October 2007
S S M T W T F
« Sep   Nov »
 12345
6789101112
13141516171819
20212223242526
2728293031  

Flickr Photos

RSS my shared links on google reader

  • An error has occurred; the feed is probably down. Try again later.
%d bloggers like this: