[Rails] Console for Testing Routes?

Tobias Lütke tobias.luetke at gmail.com
Tue Apr 4 19:00:39 GMT 2006


ruby script/console
Loading development environment.
app.get >> app.get '/'
=> 200
>> app.controller.params
=> {"action"=>"index", "controller"=>"shop"}


On 4/4/06, Michael Daines <michael.daines at gmail.com> wrote:
>
> Is there any way to do that sort of thing from a controller? Giving
> some function a path and then getting the params that path would
> produce?
>
> For example, passing this to some function:
>
>    "/store/edit/1"
>
> and getting back
>
>    [:controller => "store", :action => "edit", :id => "1"]
>
> or whatever the appropriate params for the route are.
>
>
> -- Michael Daines
>
>
> On Apr 4, 2006, at 7:06 AM, Ingo Weiss wrote:
>
> > when the "Agile Web Development" book talks about routes, there are
> > what
> > looks like console transcripts like the following:
> >
> > URL> store
> > @params = {:controller => 'store', :action = 'index'}
> >
> > Is there something like a console for testing routes (where you could
> > put in a url and see how rails would route it)??
>
> _______________________________________________
> Rails mailing list
> Rails at lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>


--
Tobi
http://shopify.com       - modern e-commerce software
http://typo.leetsoft.com - Open source weblog engine
http://blog.leetsoft.com - Technical weblog


More information about the Rails mailing list