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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T10:06:03+00:00 2026-06-06T10:06:03+00:00

I have a tab navigation page in my rails app which is shared across

  • 0

I have a tab navigation page in my rails app which is shared across all of my views. Inside I have a small text area which should change depending on the page that the user is on.

Currently I am doing this by adding a variable to the controller and using it in the render partial path, like so:

class Myapp::WebsitesController < MyappController
  def set_up
    @page = 'websites/left_text_info'
  end 

and then in my partial:

<%= render :partial => @page %>

This works but it doesn’t feel like the best ‘ruby’ way of doing things. Can anyone advise on a better way of doing this?

Thanks

  • 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-06T10:06:06+00:00Added an answer on June 6, 2026 at 10:06 am

    You can use controller_name helper method directly in your view and skip the controller part:

    <%= render "#{controller_name}/left_text_info" %>
    

    Or if the only thing that change is the content of the textarea, then perhaps the best way is to define a helper method that returns only the content for it, so you don’t need multiple partial files that are very similar.

    module ApplicationHelper
      def text_area_content
        case controller_name
        when "users"
          "content for users"
        when "articles"
          "content for articles"
        else
          "other content"
        end
      end
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an app, which has a top navigation bar and a bottom tab
I have a tab-bar and navigation controller application (like Youtube app or Contacts app).
I have an app tab based with a navigation controller, the title in the
If have a Navigation Bar and a Tab Bar in one of my views.
So I have a user profile with a tab navigation in it: <div id=proftab>
I have a tab bar along with navigation controller iphone application. Now I need
I have a tabbar application. And the item of first tab is Navigation Controller.
I have root view with both tab bar and navigation bar visible at the
We have a simple datagrid that we are enabling navigation via a the tab
I have created an HTML page which uses simple CSS (no javascript) for menu

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.