So, if I have a singleton route…
resource :shared
… and I want to have custom action names instead of the standard CRUD names, do I still do…
resource :shared do
collection do
get 'foo'
get 'bar'
match 'baz'
end
end
… or can I go without the “collection” block and pass those routes directly to the singleton?
In this case I don’t want any of the standard CRUD routes either…
Is there a simpler, cleaner way to setup routes to only the specific ajax related actions for my shared resources? I’m using this controller very sparsely, mostly it exists so that the shared view folder can serve things like my footer and my menus…
Suggestions?
You could use
matchSay for example you have a controller called
FooControllerand a method calledbaryou could do the following:match "/foo/bar/" => "foo#bar", :as => "foo_bar"That would match any request, be it GET or POST, to your
FooControllerwith methodbarReplace
matchwithpostorgetif you only want one specific http verb.