Well, mine is already big, 264 lines and counting.

The first thing that i did was to group as many controllers with only
the default routes as possible, as in:

map.resources :users, :clients, :products

They used to be in separate places and where making the file bigger
for no reason.

Another thing was to move the "admin" controllers basic config to a
block, and just call the block when i needed to configure an admin
controller, here's a sample:

  admin_configurer = Proc.new do |resource_name, options |
    options ||= {}
    map.resources resource_name, { :path_prefix => '/manage',
:name_prefix => 'manage_', :controller => "manage/#{resource_name}"
}.merge( options )
  end

  admin_configurer.call :deactivated_users, :member => {:define => :put}
  admin_configurer.call :products

I removed a lot of uneeded lines with this, but I still got a big
routes file, i guess it's something we'll need to live with. My next
idea was to separate the routes in "areas" and then get each of those
areas in a separate file and eval it at the routes.rb "draw" call, but
I haven't really done that as i think it isn't needed, at least for
now.

-
Maurício Linhares
http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/ (en)



On Fri, Jan 23, 2009 at 5:45 PM, Simone Guerra
<[email protected]> wrote:
>
> Not out of luck I'll say, that's a good idea, thanks for the tip. As for
> the routes file becoming big, do you have some idea about it?
> --
> Posted via http://www.ruby-forum.com/.
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to