I have a controller, customs_shipment_pars_checks_controller, that has
an action :new. I wish to provide a shortcut url to this action tha
bypasses any frontend pages and embedded links.
In my routes.rb file I tried this:
map.resource :parscheck,
:action => ''new'',
:controller => ''customs_shipment_pars_checks''
Which, in my ignorance I thought would equal this url:
http://localhost:3000/customs_shipment_pars_check/new
But it does not. Instead it is the equivalent of:
http://localhost:3000/customs_shipment_pars_check
Which fails with this:
NoMethodError in Customs_shipment_pars_checks#show
Now http://localhost:3000/parscheck/new works.
My question is how does one force a specific action (new) for a given
url using the #resource idiom? What I want to be able to do is to have
someone enter http:/host/parscheck and have them presented with the new
template. Do I have to do this instead?
map.connect ''parscheck'',
:action => ''new'',
:controller => ''customs_shipment_pars_checks''
--
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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.