Home How do you add a custom route to a singleton resource?
Reply: 0

How do you add a custom route to a singleton resource?

user675
1#
user675 Published in June 25, 2018, 4:07 am
map.resource  :basket, :collection => { :checkout => :post }

The above does not work for a resource, as you would expect since basket is a resource (ie. singular) not resources, so there is no concept of a collection, everything should be scoped to the current_user. In this case User has_one Basket.

However I would like to specify a custom route without having to resort to adding another line in routes, eg:

map.checkout 'basket/checkout', :controller => 'baskets', :action => 'checkout'

Is this possible?

Of course my other option is to add a checkouts controller.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.317217 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO