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 9253395
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T11:12:30+00:00 2026-06-18T11:12:30+00:00

I am following a ruby on rails tutorial and I have the following got

  • 0

I am following a ruby on rails tutorial and I have the following got in a users view <% provide(:title, 'Sign up') %> just wondering what exactly that is doing?

  • 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-06-18T11:12:31+00:00Added an answer on June 18, 2026 at 11:12 am

    This should answer your question:

    content_for?

    simply checks whether any content has been captured yet using #content_for

    Useful to render parts of your layout differently based on what is in your views.

    Examples

    Perhaps you will use different css in you layout if no #content_for :right_column

    <%# This is the layout %>
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
     <title>My Website</title>
     <%= yield :script %>
    </head>
    <body class="<%= content_for?(:right_col) ? 'one-column' : 'two-column' %>">
     <%= yield %>
     <%= yield :right_col %>
    

    provide(name, content = nil, &block)

    The same as content_for but when used with streaming flushes straight back to the layout. In other words, if you want to concatenate several times to the same buffer when rendering a given template, you should use content_for, if not, use provide to tell the layout to stop looking for more contents.

    Short answer:
    In the Ruby on Rails tutorial the special rails function provide is used to set a different title on each page. Depending on which static_page you are on the title is set accordingly. Further explanation is given in 3.3.3 ("Embedded Ruby") in the Ruby on Rails tutorial book.

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

Sidebar

Related Questions

I am following Lynda ruby on rails tutorial. Here is the code I have
I am following Lynda ruby on rails tutorial. I have already ran the code
I am following Micheal Hartl's Ruby on rails tutorial 2.3 Edition and I have
I have been following this tutorial, http://ruby.railstutorial.org/chapters/modeling-users?version=3.2#top , which I find great, but it
I'm reading through the excellent Ruby on Rails Tutorial and have encountered the following
I've been following the exercises in the Ruby-on-Rails tutorial by M. Hartl. I have
I am following ruby on rails tutorial . And I have few questions: 1.
I am following this routing tutorial for Ruby on Rails: http://guides.rubyonrails.org/routing.html It says that
I am following a tutorial about Ruby on Rails, and the tutorial got updated
I am new to Rails & Ruby and have been following the http://ruby.railstutorial.org/ruby-on-rails-tutorial-book and

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.