How can I use a model from a gem in Rails 3? -


I have a gem in which there are some active-recoder-derived models. They are testing and working

I've added the dependence of that gem, but when I try to use pages that use those formats, for example, I get a dangerous method error

Undefined method mygem_mymodel_path'`

Note that the models were always in my app / model's directory and all were OK; Escape to my model in this gem is the cause of sorrow.

Update 1: In response to Robin's question:

  & gt; Rail Console & gt; MyModel = & gt; For request of Robin for form code,  form ARB:  
    & lt;% = form_for (MyModel.new ,: Remote = & gt; True ,: html = & gt; {: class => "new_mymodel_form" ,: id = & gt; "new_mymodel_form"}) | F | -% & gt;   

After Robin's suggestions, this is the only way I have found around it:

Update 3: An ugly solution

With a module called MyModel and a module named MyModule:

  for post / mymodels, 'MyModels # create', as such: 'my_module_mymodels < / Code>  

Because 'like' let's, you control the path symbol name. I use a lot of 'resources' macros, but it seems that this module does not know to add name to the path symbol, even if the form_for modules add a name, I think there is a way to solve it, but I Do not know anything about the scenario.

use the field :

  Scope: like = & gt; "Mymodule" does the resource: end of my_resources    

Comments