i have problem little bit with Rails router and form generator. My application have namespaced modules for models and controllers. Module is used to easier abstraction to another projects.
I using in routes.rb
scope method instead namespace, because i wan't have "ugly" path helpers.
It looks like:
scope module: :taxonomy do
resources :taxonomies do
resources :terms
end
end
Problem is that when i want to edit taxonomy (url: taxonomies/1/edit
) i get an error:
undefined method `taxonomy_taxonomy_path'
cause my route is instead only taxonomy_path
is there any way how reach form_for @taxonomy
to recognize that route is scoped? without used form_for @taxonomy, url: taxonomy_path(@taxonomy)
which is not cure. Because @taxonomy object in controller methods within respond_with @taxonomy
always refereces to taxonomy_taxonomy_url
my models:
module Taxonomy
class Taxonomy < ActiveRecord::Base
has_many :taxonomy_terms, inverse_of: :taxonomy
has_many :terms, through: :taxonomy_terms
class Term < ActiveRecord::Base
has_one :taxonomy_term, inverse_of: :term
has_one :taxonomy, through: :taxonomy_term
and controllers:
module Taxonomy
class TaxonomiesController < ApplicationController