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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T07:55:47+00:00 2026-06-10T07:55:47+00:00

I created a simple application with a news module and defined the news as

  • 0

I created a simple application with a news module and defined the news as a separate mountable engine (it will be used on other projects too). I need to have the ability to mount the admin and user parts of the engine as separate routes on parent application. Now I can mount the whole engine as

Rails.application.routes.draw do
     mount Jnews::Engine => "/news"
end

but I want to separate admin and user routes on parent app as /news for user and /admin/news for admins. Is this possible?

  • 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-10T07:55:49+00:00Added an answer on June 10, 2026 at 7:55 am

    I think it depends on why you want to do this:

    1. If you want to keep users and admins as separate code in the news gem – then you probably want to isolate 2 namespaces, and then mount each of those – which might involve having them as separate engines themselves.

    2. If what you want is (and this is what I think you mean?) is to have the code shared in the news engine, but accessed at 2 different url’s in the main application based on whether the user is a plain user or an admin? What I would do in that case is something like this:

    in the main application

    Rails.application.routes.draw do
       mount Jnews::Engine => "/app"
    end
    

    in the engine routes

    Jnews::Engine.routes.draw do
        match "/news", :to => "some_controller#some_action"
        match "/admin/news", :to => "some_controller#some_action"
    end
    

    And then in the main application, based on what the user is (user or admin) you can redirect to either app/news or app/admin/news

    I hope that helps, I am not really sure about doing conditional routing.

    However, here is a really good guide for routing: http://guides.rubyonrails.org/routing.html

    You could perhaps try something along the lines of mounting an engine with dynamic routing?

    mount Jnews::Engine => ":user_id/news"
    

    where you end up with Jnew::Engine routed at either user/news and admin/news? I have never actually done that, so I don’t know if it’s possible, however… maybe?

    Let me know if any of this helps 🙂
    Cheers

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

Sidebar

Related Questions

I've created a simple Flex application to fetch an XML file. I need a
I've created a simple mountable application in rails 3.1.3 using command: $ rails plugin
I created a simple application which will read all the files and folders kepts
I created a simple application inspired by this example in order to test all
I created a simple Sudoku application, where each 3x3 squares is a user control,
I have created a simple blog application with Ruby on Rails. The applications consists
I've created a very simple Enterprise Application project with about 7 entity beans and
I have created a simple win 32 application..in which it has a textbox and
I've created a simple console Java application that is built with Maven. Is there
I created a simple ASP.NET MVC version 1.0 application. I have a ProductController which

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.