Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7697479
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T22:01:23+00:00 2026-05-31T22:01:23+00:00

I just created a new rails app in Rails 3.1.1, and my application layout

  • 0

I just created a new rails app in Rails 3.1.1, and my application layout is not being rendered in the browser. The only thing that is rendered is the code that I put in the views (e.g. views/public/home.html.erb).

It’s only rendering what is being piped through <%= yield %>. For instance, localhost:3000/public/home is on only displaying this:

<h1>Homepage</h1>
<h2>Here we go.</h2>

<a href="/#">Visit the login page</a>

Here’s what’s in my /layouts/application.html.erb:

<!DOCTYPE html>
<html>
<head>
  <title>My App</title>
  <%= stylesheet_link_tag    "application" %>
  <%= javascript_include_tag "application" %>
  <%= csrf_meta_tags %>
</head>
<body>

  <ul class="user_nav">
  <% if current_user %>

      <li>
        Logged in as <%= current_user.email %>.
      </li>
      <li>
        <%= link_to "Log out", logout_path %>
      </li>
  <% else %>
      <li>
        <%= link_to "Sign up", signup_path %>
      </li>
      <li>
        <%= link_to "Log in", login_path %>
      </li>
  <% end %>
  </ul>


  <% flash.each do |name, msg| %>
    <%= content_tag :div, msg, :id => "flash#{name}" %>
  <% end %>

  <%= yield %>

  <h1>test!</h1>


</body>
</html>

Here are my routes as well:

 root :to => "public#home"
  match "/secret" => "public#secret"


  get "logout" => "sessions#destroy", :as => "logout"
  get "login" => "sessions#new", :as => "login"
  get "signup" => "users#new", :as => "signup"
  resources :users
  resources :sessions

Here’s what’s in application_contoller.rb:

class ApplicationController < ActionController::Base
  protect_from_forgery

end

Here’s what’s in public_controller.rb:

class PublicController < ActionController::Base
  protect_from_forgery

  def home
  end

  def secret
  end
end

Here’s what’s in sessions_contoller.rb:

class SessionsController < ApplicationController
  def new
  end

  def create
    user = login(params[:email], params[:password], params[:remember_me])
    if user
      redirect_back_or_to root_path, :notice => "Logged in!"
    else
      flash.now.alert = "Email or password was invalid"
      render :new
   end
  end

  def destroy
    logout
    redirect_to root_path, :notice => "Logged out"
  end
end

And here’s what’s in users_controller.rb:

class UsersController < ApplicationController
  def new
    @user = User.new
  end

  def create
    @user = User.new(params[:user])
    if @user.save
      redirect_to root_path, :notice => "Signed up!"
    else
      render :new
    end
  end

end
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T22:01:24+00:00Added an answer on May 31, 2026 at 10:01 pm

    I just ran into this same problem myself and the problem is just a simple mistake.

    Your controller PublicController is subclassing “ActionController::Base”. Controllers other than your ApplicationController need to subclass from ApplicationController in order for their views to be rendered within the application.html.erb layout

    If you change

    PublicController < ActionController::Base
    

    to

    PublicController < ApplicationController
    

    it should work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

so I just created a new app that is references an older app of
I just installed ruby on rails on windows. install mysql and created a new
I've just created a new view based application, and now I want to set
I'm creating a new plugin for a jruby on rails application that will eventually
I'm creating a new rails app for my business, and I just finished a
I'm beginning to work on a new Ruby on Rails application that is a
I am new to rails and just created a new project. I created the
I created a brand new Rails 3.1 app. I added the twitter bootstrap CSS
I'm creating my first ROR application. Details: creating new app -> rails new simple_cms
I just created a new table and filled it with data. When I run

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.