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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T05:07:02+00:00 2026-06-11T05:07:02+00:00

I have a Rails engine, MyEngine , that doesn’t have an isolated namespace. I’m

  • 0

I have a Rails engine, MyEngine, that doesn’t have an isolated namespace. I’m trying to use the polymorphic helpers to generate links to resources, as per the docs.

An engine route:

# config/routes.rb
...
  namespace :admin do
    resources :my_resource
  end
...

Example output of rake app:routes (remember, this is an Engine):

    admin_my_resources GET    /admin/my_resources(.:format)          my_engine/admin/my_resources#index
                       POST   /admin/my_resources(.:format)          my_engine/admin/my_resources#create
 new_admin_my_resource GET    /admin/my_resources/new(.:format)      my_engine/admin/my_resources#new
edit_admin_my_resource GET    /admin/my_resources/:id/edit(.:format) my_engine/admin/my_resources#edit
     admin_my_resource PUT    /admin/my_resources/:id(.:format)      my_engine/admin/my_resources#update
                       DELETE /admin/my_resources/:id(.:format)      my_engine/admin/my_resources#destroy

If my_resource is an instance of a MyResource model with ID 12345, I’d expect:

polymorphic_url([my_engine, :admin, my_resource])

to render:

/my_engine/admin/my_resource/12345

but I was wrong. Instead, I get an exception:

undefined method `admin_my_engine_my_resource_path'...

So, polymorphic_url is trying to use admin_my_engine_my_resource_path where it really should be using something more like my_engine.admin_my_resource_path(my_resource)

Rails seems to be adding :admin the wrong way around… or am I doing it wrong?

  • 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-11T05:07:03+00:00Added an answer on June 11, 2026 at 5:07 am

    Have you tried doing this via a scope instead of a namespace?

    See this SO article for a better explanation. Rails Scoped Routing

    A good example of this is the devise gem.

    Good luck!

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

Sidebar

Related Questions

I have a Rails engine (someone else's gem) that I am trying to modify
I have been trying to use FactoryGirl while developing a Rails 3 mountable engine,
I have a Rails engine that defines a class method top(count) on a model
I created a Rails 3 engine that is namespaced. Within my engine, I have
I have a Rails 3 app that I am turning into a Rails engine
I've built myself a Rails Engine that requires that the main app have a
The context : I have a rails engine (gem) that uses omniauth inside it
I'm trying to set a testing framework for a rails engine. I have everything
I have a Rails 3 engine gem that is for basic user authentication and
Using Rails 3.2.2 and Ruby 1.9.2. I have a rails mountable engine EngineA that

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.