Forum: Rails Engines development Routes in Engines

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
00e3a96684ab390a350b0271e98741d3?d=identicon&s=25 Nshbrown Nshbrown (nshb)
on 2006-03-10 19:42
(Received via mailing list)
I had remembered pondering this myself, and it is likely that several
others
may have as well.

I haven't tested this yet, but I am under the impression throwing this
inside of a /vendor/plugins/my_engine/lib/routes.rb, very well may work.

It would be great to create an abstract layer ontop of the Rails engines
to
define new routes. Such as:

Engines.map.connect "#{ADMIN_PAGE_DIR}/*name",
:controller=>'view_pages',
:action=>'show_page'

Here is the snippet:

ActionController::Routing::Routes.draw do |map| map.connect
"#{ADMIN_PAGE_DIR}/*name", :controller=>'view_pages',
:action=>'show_page '
  map.connect '', :controller => "admin_pages", :action=>"edit_pages"
  map.connect ':controller/service.wsdl', :action => 'wsdl'
  map.connect ':controller/:action/:id'
end

Has anyone else done something like this yet? I think the biggest
advantage
to this is doing some new hacks on the ActionController::Routing::Routes
to
add domain wildcards. So those who are doing username.example.com, can
automatically route it to the specific controller and action.

I will be embarking on this sooner or later, but would be nice to see
who
else has done what.

-Nb

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 Nathaniel S. H. Brown                           http://nshb.net
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Bb46488d2c90d51f366cafc776e2b3ad?d=identicon&s=25 Jeff Lindsay (progrium)
on 2006-03-17 01:55
(Received via mailing list)
I've been thinking about this myself, but I haven't done anything yet.
Actually, I played with it a little today, but nothing really
productive come of it.

My reason for doing so is to remove the need to add anything to
config/routes.rb, but also somehow allowing you to overwrite the
engine defaults if you want, or not having them at all. Seems a bit
challenging.

-jeff

On 3/10/06, Nathaniel S. H. Brown <nshb@inimit.com> wrote:
> :action=>'show_page'
> Has anyone else done something like this yet? I think the biggest advantage
>  Nathaniel S. H. Brown                           http://nshb.net
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> _______________________________________________
> engine-developers mailing list
> engine-developers@lists.rails-engines.org
> http://lists.rails-engines.org/listinfo.cgi/engine...
>


--
Jeff Lindsay
http://blogrium.com/
This topic is locked and can not be replied to.