Without Book Interview Questions and Answers | Online Test | Moct Test
Download Android App in your Android Device from Google Play Store
- Search for "Withoutbook Practice Exam Test" in Mobile/Tablet Play Store
Institute Training Search by Name or Email

Exams Attended

Make Homepage

Bookmark this page

Subscribe Email Address

Ruby On Rails Interview Questions and Answers

Ques. What is the purpose of Layouts in Ruby on Rails?

Layouts are partial ruby/html files that are used to render the content pages. 

There are placed in the folder: app/views/layouts

Items that you would typically put in this folder are things like headers/footers, navigation elements, etc.

Here’s a sample layout file: /app/views/layout/application.html.erb

<html lang="en">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Learning System | <%= @page_title || 'Admin Area' %></title>
    <meta name="author" content="Anil Punjabi">
    <%= stylesheet_link_tag('public', 'admin', :media => 'all') %>
    <%= javascript_include_tag('application') %>
    <div id="header">
      <h1>Learning System</h1>
    <div id="main">
      <% if !flash[:notice].blank? %>
      <div class="notice">
        <%= flash[:notice] %>
      <% end %>
      <div id="content">
        <%= yield %>
    <div id="footer">
      <p id="copyright">© / Anil Punjabi</p>
Say you are trying to access the page as shown below:
Then the contents of the index.html.erb would be placed above in the section shown under <% yield %> above and sent back to the user.
Is it helpful? Yes No

Most helpful rated by users:

©2016 WithoutBook