It might be a bit long, but I’ll try to explain my problem clearly.
Here are my routes:
resources :jobs do
scope :module => :job_scope do
resource :company do
resource :company_page
end
end
end
Ok, so the url to edit the company page is:
jobs/53-jobname/company/company_page/edit.
This is handled by the controller
JobScope::CompanyPagesController << ::CompanyPagesController
A CompanyPage has many containers (containers are polymorphic)
When I try to render the containers, I do
<% @containers.each do |container| %>
<%= render container %>
<% end %>
Usually, it would render, for instance:
/notes/_note.html.erb
/galleries/_gallery.html.erb
But now, it renders
job_scope/notes/_note.html.erb
I dont want to have to repeat my views in any ways.
Is my only option to construct the path myself? Something like (in a helper):
render "#{container.class.name.underscore.pluralize}/#{container.class.name.underscore}"
Thanks !
http://groups.google.com/group/rubyonrails-core/browse_thread/thread/9a5219dc05550934
These guys have the same problem. I dont think there is an elegant solution right now. We’d need some kind of option to prevent this behaviour…