Hi all
i want to use a master template for all my view files to use the rails
DRY feature.So How can i achieve that. I already googled it but
unfortunately didn’t get much help.
any help would be appreciated
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/ 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
Demo <%= stylesheet_link_tag :all %> <%= javascript_include_tag :defaults %> <%= csrf_meta_tag %><%= yield %>
If you haven’t done so already I’d recommend starting right here:
For information more focused on layouts and views go here:
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.So How can i achieve that. I already googled it but
unfortunately didn’t get much help.
any help would be appreciated
Are you looking for the use of layouts?
Best,
Marnen Laibow-Koser
http://www.marnen.org
[email protected]
thank u…very good tutorials…