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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T08:11:22+00:00 2026-05-13T08:11:22+00:00

by default, when i ask rails controller to do messages/index, he does def index

  • 0

by default, when i ask rails controller to do messages/index, he does

def index
 respond_to{|fmt| fmt.html}
end

and shows app/views/messages/index.html.erb

there is a customer which wants his instance of the platform to display views differently (and changes cannot be done with css only).

solution i think of would be

  1. create directory app/views/#{customername}, which would have same structure as app/views, but would only have views which have to override default ones.

  2. setting an array constant containing list of views which have to be overriden (if not, they should load the default views)

    CUSTOM_VIEWS["messages"]=["index","show","edit"] 
    

    somewhere in the customer-specific config file

  3. in all controller actions do something like

    def index
     respond_to do |fmt| 
      fmt.html do
       if CUSTOM_VIEWS[params[:controller]].include?(params[:action])
        #override default app/views/messages/index.html.erb with app/views/customername/messages/index.html.erb 
        render "#{customername}/#{params[:controller]}/#{params[:action]}"
       end
      end
     end
    end
    

or is there better/faster solution/plugin to do that?

  • 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-13T08:11:22+00:00Added an answer on May 13, 2026 at 8:11 am

    i believe “view_paths” along with “prepend_view_path” can be an answer to my question

    for example

    http://www.axehomeyg.com/2009/06/10/view-path-manipulation-for-rails-with-aop/

    upd:

    solved with simple add to application_controller

    def override_views
     if APP_CONFIG['pr_name']!=nil
          ActionController::Base.view_paths=[RAILS_ROOT+"/app/custom_views/"+APP_CONFIG['pr_name'],RAILS_ROOT+"/app/views/"]
     end 
    end
    

    where APP_CONFIG[‘pr_name’] is specific product name.

    basically what it does is loading custom view from app/custom_views/customername/ if it exists for specific controller action, if not it loads default view from app/views/

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

Sidebar

Ask A Question

Stats

  • Questions 295k
  • Answers 295k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I assume you refer to the Field.Index fields ANALYZED and… May 13, 2026 at 6:55 pm
  • Editorial Team
    Editorial Team added an answer You could create a Mapping table containging the country and… May 13, 2026 at 6:55 pm
  • Editorial Team
    Editorial Team added an answer The problem has been pinpointed: The SPN in ADSI was… May 13, 2026 at 6:55 pm

Related Questions

This question is a spin-off from this one . Some history: when I first
I am trying to recreate my cookie what would be normally generated by FormsAuthentication.SetAuthCookie()
When creating an instance of a button within a .NET WinForms application, the .CausesValidation
I really like the way ASP.NET MVC works. I'd love to implement it on
We are developing an app that consists of a web server that hosts a

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.