List Info

Thread: Restricting http method on "normal" routes




Restricting http method on "normal" routes
country flaguser name
United States
2007-08-29 20:52:39
How can I ensure a certain "normal" route (not
generated by
map.resources) uses only GET (or POST) for that matter?

I know I can do this from the controller, as "in the
old days" when
one checked that people where only POSTing to your create
actions. But
is there any way to do it from the Route map directly?
(since in my
mind that's where it makes the more sense to put that
information)

I'm almost certain I saw on #rubyonrails an example of this
a few days
ago, but I asked there and no one answered though, so I
don't know :-/

Something like http://pastie.caboo.se/9
2285

Why I'm not using :collection on map.resources, you might
ask? Well, I
want to use the auto_completer helpers, *and* I like
"nice" URIs, so I
want to have "/characters/find", but :collection
=>
{ :auto_complete_for_character_name => :get } would give
me "/
characters/auto_complete...." which is undesirable.

Thanks,
-Nicolas


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Ruby on Rails" group.
To post to this group, send email to rubyonrailsgooglegroups.com
To unsubscribe from this group, send email to
rubyonrails-unsubscribegooglegroups.com
For more options, visit this group at http://gro
ups.google.com/group/rubyonrails
-~----------~----~----~----~------~----~------~--~---


Re: Restricting http method on "normal" routes
country flaguser name
United States
2007-08-30 00:11:30
I wasn't that far, someone on #rubyonrails finally answered


:conditions => { :method => :get }

-Nicolas

On Aug 29, 10:52 pm, Nicolas Sanguinetti <godf...gmail.com> wrote:
> How can I ensure a certain "normal" route
(not generated by
> map.resources) uses only GET (or POST) for that
matter?
>
> I know I can do this from the controller, as "in
the old days" when
> one checked that people where only POSTing to your
create actions. But
> is there any way to do it from the Route map directly?
(since in my
> mind that's where it makes the more sense to put that
information)
>
> I'm almost certain I saw on #rubyonrails an example of
this a few days
> ago, but I asked there and no one answered though, so I
don't know :-/
>
> Something likehttp://pastie.caboo.se/9
2285
>
> Why I'm not using :collection on map.resources, you
might ask? Well, I
> want to use the auto_completer helpers, *and* I like
"nice" URIs, so I
> want to have "/characters/find", but
:collection =>
> { :auto_complete_for_character_name => :get } would
give me "/
> characters/auto_complete...." which is
undesirable.
>
> Thanks,
> -Nicolas


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Ruby on Rails" group.
To post to this group, send email to rubyonrailsgooglegroups.com
To unsubscribe from this group, send email to
rubyonrails-unsubscribegooglegroups.com
For more options, visit this group at http://gro
ups.google.com/group/rubyonrails
-~----------~----~----~----~------~----~------~--~---


Re: Re: Restricting http method on "normal" routes
user name
2007-08-30 00:56:04
You can also look at verify

On 8/30/07, Nicolas Sanguinetti < godfocagmail.com">godfocagmail.com > wrote:

I wasn't that far, someone on #rubyonrails finally answered

:conditions => { :method => :get }

-Nicolas

On Aug 29, 10:52 pm, Nicolas Sanguinetti < godf...gmail.com">godf...gmail.com> wrote:
>; How can I ensure a certain "normal" route (not generated by
> map.resources) uses only GET (or POST) for that matter?
&gt;
> I know I can do this from the controller, as "in the old days" when
> one checked that people where only POSTing to your create actions. But
> is there any way to do it from the Route map directly? (since in my
> mind that's where it makes the more sense to put that information)
>
>; I'm almost certain I saw on #rubyonrails an example of this a few days
>; ago, but I asked there and no one answered though, so I don't know :-/
>
&gt; Something likehttp://pastie.caboo.se/92285
>
> Why I'm not using :collection on map.resources, you might ask? Well, I
> want to use the auto_completer helpers, *and* I like "nice" URIs, so I
> want to have "/characters/find", but :collection =>
> { :auto_complete_for_character_name => :get } would give me "/
> characters/auto_complete....&quot; which is undesirable.
>
>; Thanks,
&gt; -Nicolas






--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails"; group.
To post to this group, send email to rubyonrailsgooglegroups.com
To unsubscribe from this group, send email to rubyonrails-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/rubyonrails
-~----------~----~----~----~------~----~------~--~---

[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )