venkata reddy wrote in post #977331: > Hi all > i want to use a master template for all my view files to use the rails > DRY feature.
What do you mean by the rails DRY feature? DRY is coding practice not a framework feature. > So How can i achieve that. I already googled it but > unfortunately didn't get much help. > any help would be appreciated You use layouts for this. You put the common layout ERb (or HAML) in ./app/views/layouts then put the page specific ERb in ./app/views/<whatever> and use <%= yield %> and/or <%= yield :some_content %> inside the layout templates to mark where the page specific code should be rendered. Rails will, by convention, look for ./app/layouts/application.html.erb if no other layout is specified. ./app/layouts/application.html.erb ------------------------------- <!DOCTYPE html> <html> <head> <title>Demo</title> <%= stylesheet_link_tag :all %> <%= javascript_include_tag :defaults %> <%= csrf_meta_tag %> </head> <body> <%= yield %> </body> </html> ------------------------------- If you haven't done so already I'd recommend starting right here: http://guides.rubyonrails.org/getting_started.html For information more focused on layouts and views go here: http://guides.rubyonrails.org/layouts_and_rendering.html -- 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

