Forum: Ruby on Rails No route for :method => :get

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.
Shandy N. (Guest)
on 2007-08-01 20:16
I have been trying to get my application to simply pop open a simple
widow with a form laid out in that window. I get it to open this window,
but the error I get says:

no route found to match "/enroll/airline_preferences.rhtml" with
{:method=>:get}

I have tried to place :method => 'post' in my code with little success.
I guess I don't understand hwo different does RoR dehave based on
whether it is a get or a post? Posts executes the method with the same
name as the page upon load. How is get different. Also, I am using
link_to to open up this page. Thanks,

~S
Rob B. (Guest)
on 2007-08-01 20:45
(Received via mailing list)
On Aug 1, 2007, at 12:16 PM, Shandy N. wrote:

> success.
> I guess I don't understand hwo different does RoR dehave based on
> whether it is a get or a post? Posts executes the method with the same
> name as the page upon load. How is get different. Also, I am using
> link_to to open up this page. Thanks,
>
> ~S

Well, seeing your routes.rb (the part that you expect to be relevant)
would certainly help.  You can manually add:

   :conditions => { :method => :put }

to your map.connect (or named route) to require a certain type of
request (the default is to allow any)

You should also show the piece of your view that implements the form.

-Rob

Rob B.    http://agileconsultingllc.com
removed_email_address@domain.invalid
Jeff E. (Guest)
on 2007-08-03 06:49
(Received via mailing list)
if you're using restful routes, e.g. "map.resources :enroll" in your
routes, then you can add such a URL via

map.resources :enroll, :collection => { :airline_preferences => :get }

that enables the URL /enroll;airline_preferences

it also provides the named route airline_preferences_enroll for usage
in controllers and views to generate the URL.


On Aug 1, 12:16 pm, Shandy N. <removed_email_address@domain.invalid>
This topic is locked and can not be replied to.