I think that the complex Rails applicatio
The way is really simple. Use with_optio
1 map.with_options(:controller => 'posts', 2 :name_prefi x => 'posts_', 3 :path_prefi x => 'posts') do |posts| 4 # posts_rss_ path => 'posts/rss' 5 posts.rss 'rss', :action => 'rss' 6 end
Still complex? Okey, I have written the plugin for you.
With this plugin, you can draw the routes belonging to some controller
1 map.with_controller('posts') do |posts| 2 posts.rss # posts_rss_ path => 'posts/rss' 3 end
As you can see, there's one more thing.
I have also installed MapperWith
1 class MapperWithController 2 def initialize (mapper) 3 @mapper = mapper 4 end 5 6 def method_mis sing(name, *args, &block) 7 path, *args = args 8 path ||= name.to_s 9 args.unshift path 10 @mapper.send name, *args, &block 11 end 12 end
map.namesp
does nearly same thing, but it couldn't be used for this purpose because of it is optimized to making namespaces
posted by
takiuchi
on Fri 14 Mar 2008
at 19:00