Hi all. I'm having some trouble with nested routes and duplicate namespaces. I have an Article and Advert model, both with an associated Publication model:
class Article has_one :publication end
class Article::Publication belongs_to :article end
class Advert has_one :publication end
class Advert::Publication belongs_to :advert end
Each Publication model is different enough that it makes no sense to have just one Publication model with STI or polymorphism. Also, there are numerous other models such as Cancellation, Payment etc that are namespaced for the same reason.
here's the routes I have for the above resources:
resources :articles do resource :publication, :module => :article end
resource :adverts do resource :publication, :module => :article end
this gives me article_publication_path and advert_publication_path which are fine. The problem occurs with polymorhic_url (used by form_for). Given [@article, @publication], it will try to generate article_article_publication_url which of course hasn't been defined. I've tried several of the options in the rails routing guide to no avail so for now, I'm manually specifying the path in form_for
has anyone come across something similar or do you know of a potential solution?
thanks, Ev