Mike Garey
2006-Nov-04 02:36 UTC
[Rails] Problem with edge rails, controller namespaces and routes
I just upgraded to edge rails so I can use the BigDecimal support for
monetary calculations. I''ve just come across the following problem..
Right now, I''ve got a content controller which is responsible for
updating much of my site''s content. I''ve decided to make this
a
subclass of Admin, so I can organize my administrative related
controllers into their own directory. So I have the following class
definition inside
''app/controllers/admin/content_controller.rb'':
class Admin::ContentController < ApplicationController
....
end
and then in my routes file, I have:
map.with_options(:controller => ''admin/content'') do
|content|
content.content_list_faq
''admin/content/faq/list/:section'', :action =>
''list_faq''
end
now, this worked perfectly in Rails 1.1.6, but as soon as I upgraded
to edge, I started getting the following error from one of my views:
content_list_faq_url failed to generate from {:action=>"list_faq",
:controller=>"admin/content"}, expected:
{:action=>"list_faq",
:controller=>"admin/content"}, diff: {}
which doesn''t really make a whole lot of sense, since the expected
looks exactly the same as what I''m using, and the diff hash is empty..
the line causing the error is the following:
<%= link_to(''FAQ Management'', content_list_faq_url) %>
While searching for some advice, I came across the following site
which mentions that using namespaces for controllers is more hassle
than it''s worth, and to just forget about them:
http://glu.ttono.us/articles/2006/08/30/guide-things-you-shouldnt-be-doing-in-rails
so is that the current recommendation? To just forget about controller
namespaces and have everything under the ''app/controllers''
directory?
Or is there something else going on that I''m missing?
Mike
