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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T16:09:57+00:00 2026-06-07T16:09:57+00:00

I have a gem that has some ActiveRecord-derived models. They are tested and work.

  • 0

I have a gem that has some ActiveRecord-derived models. They are tested and work.

I’ve added a dependency to that gem, but when I try to access pages that refer to that model in a form_for statement, for example, I get the dreaded method_missing error:

undefined methodmygem_mymodel_path’`

Note I had the models in my app/models directory as is usual and all was well; migrating my models to this gem has been the cause for grief.

UPDATE 1:
In response to Robin’s question:

> rails console
> MyModel
=> MyGem::MyModel(id:string, name:string)

Update 2: For Robin’s request for form code
Form erb:

<%= form_for(MyModel.new, :remote => true, :html => { :class => "new_mymodel_form", :id => "new_mymodel_form"}) do |f| -%>

After Robin’s suggestions, this is the only way I’ve found around it:

UPDATE 3: a ugly workaround

With a model called Mymodel and a module called MyModule:

post '/mymodels', to: 'mymodels#create', as: 'my_module_mymodels

Because ‘as’ let’s you control the path symbol name. I’d much rather use ‘resources’ macro, but it seems it doesn’t know to add the module name to the path symbol when it creates it, even though form_for appends the module name. I assume there is a way to solve this, but I can’t find anything about this scenario.

  • 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-07T16:10:00+00:00Added an answer on June 7, 2026 at 4:10 pm

    Use scope:

    scope :as => "mymodule" do
      resources :my_resources
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Rails 3 gem which has some rake tasks that should only
I have created a gem that adds a new method to the class ActiveRecord::Base.
Given a gem that defines top-level classes that clash with some code I have
I have developed a gem which implements some algorithms that we'll use within a
I'm writing some specs that test the template files in a gem that has
Just have read sass changelog and found out that FSSM (the gem that had
I have a simple Ruby script that uses the rb-appscript gem to control iTunes,
I ran gem sources -c so that I have to deliberately specify where I
I have a view spec that was passing but is broken now that pagination
I see that the IronRuby team has documented using ActiveRecord in IronRuby with MSSQL

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.