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

  • Home
  • SEARCH
  • 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 6599115
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:26:55+00:00 2026-05-25T18:26:55+00:00

I need to display advertisement only on main page of my website (example.com). I’ve

  • 0

I need to display advertisement only on main page of my website (example.com). I’ve set up a root_url to posts controller:
map.root :controller => "posts", :action => "index"

I have global layout and I want to place in that view IF statement. The problem is that I have no idea how to check that root_url is displaying in certain moment.

  • 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-25T18:26:55+00:00Added an answer on May 25, 2026 at 6:26 pm

    This looks like a better solution to me:

    Test for some flag in the view to display the section in question. Set the flag in the controller’s action you want it to show for (here PostsController#index).

    See discussion here:

    • Ruby on Rails: conditionally display a partial

    It’s better, because with the same initial effort, later on you can set the flag based on more involved conditions (not only the page address), and for other actions.

    Also, keep logic out of views as much as possible.

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

Sidebar

Related Questions

I need display data from a web page in a ListView, for example if
i am developing one application with map view i need display the weather depends
I need to display, for example, the Bad credentials message in another language. So
I need display in web page fingerprints of SSL Certificate. Is it possible in
In example code below UIAlertView is show after delay, but i need display it
I need to display only the first two rows in a table , and
I use AdMob service to display advertisement in my android app. I need to
I'm creating an advertisement platform for my website, where we need select 3 rows
I need to display the data from a servlet in a jsp page. At
I need to display a page with detailed information about a product. e.g. <ul>

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.