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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T19:30:56+00:00 2026-05-24T19:30:56+00:00

Lets consider the following situation. There is products_controller which can be accessed from Admin

  • 0

Lets consider the following situation.
There is products_controller which can be accessed from “Admin” and “Configure” sections of the Ruby on Rails application.

In the view I need to differentiate which section I am currently in (i.e. “Admin” or “Configure”). What would be there best practice of achieving the right result?

Couple of solutions come to mind?

  1. Append the “referrer” option as a parameter and use it to distinguish where I came from (i think this would be super-ugly and break the nature of rest).

  2. Create separate action pairs in the controller(i.e. new/create and admin_new/ admin_create).

What would be the right approach in the given situation?

  • 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-24T19:30:57+00:00Added an answer on May 24, 2026 at 7:30 pm

    If it is just for logging purposes, adding a parameter should be enough.

    If logic of how things are handled depends on where user came from, go for different routes mapping to different actions.

    If you don’t wan’t to add a parameter, but it is for logging purposes, you can also create non-conventional route:

     resources :products, :except => [:new, :create] do
       collection do
         get  products/new(/:section) => "products#new"
         post products(/:section) => "products#craete"
       end
     end
    

    Now you can have new_message_path(:section => "admin") and it will result in path /products/new/admin, you will have the :section available in params[:section].

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

Sidebar

Related Questions

Let's consider the following scenario: a function which can generate code colors from white
Lets consider I have the following function: SomeType createSomeType(); which can throw depending on
Consider the following situation: There is an xml that contains data @XmlData The @XmlData
For my question lets consider the following sample table data: ProductID    ProductName    Price   Category 1                Apple                 5.00       Fruits
Lets consider that I have a public property called AvatarSize like the following, public
Lets us consider the following program : #include <stdlib.h> int main(int argc, char **argv){
Consider the following situation: - Suppose my app allows users to create the states
For example lets consider the following 2 codes: for (i = 0; i <
So, please consider the following situation I have a super class of type Shapes
Lets consider following two codes First: for (int i=0;i<10000000;i++) { char* tab = new

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.