Hi everybody! Does anyone know the best approach to create local-only path? ====code begin=== MyApp::Application.routes.draw do match ''quicksearch'' => ''application#quicksearch'' end ===code end== I want the path ''\quicksearch'' to be exactly local (available from application itself only), any external requests must be ignored. The first thing came into my mind is to create small request filter based on IP (?). Of course... Filter can be route-level or middleware-level, but anywhere.. IP address as a base of distinction seems to me not so good. Any opinions, folks? -- 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 https://groups.google.com/groups/opt_out.
On Tue, Jul 24, 2012 at 10:49 AM, Valery Kvon <addager-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I want the path ''\quicksearch'' to be exactly local (available from application itself only), any external requests must be ignored.Then why even bother to access it through a controller? -- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org http://about.me/hassanschroeder twitter: @hassan -- 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 https://groups.google.com/groups/opt_out.
If the javascript runtime could do it… :) On 24.07.2012, at 23:02, Hassan Schroeder wrote:> On Tue, Jul 24, 2012 at 10:49 AM, Valery Kvon <addager-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >> I want the path ''\quicksearch'' to be exactly local (available from application itself only), any external requests must be ignored. > > Then why even bother to access it through a controller? > > -- > Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > http://about.me/hassanschroeder > twitter: @hassan > > -- > 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@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > >-- 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@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
I''ve never done something like this before (routing to application controller), but weeks ago I saw this project in this mail list https://github.com/devton/whatismyvideoid and in its routes file he made something like you mentioned. Maybe you can use it as an example. Javier Q. -- 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 https://groups.google.com/groups/opt_out.
On Tue, Jul 24, 2012 at 12:09 PM, Valery Kvon <addager-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> If the javascript runtime could do it… :)JavaScript? Is this executing on the client or on the server? -- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org http://about.me/hassanschroeder twitter: @hassan -- 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@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Oops, I just realized that javascript code executing always on client''s browser, and any request will have ''REMOTE_ADDR'' = client''s IP. Thus, there is only approach to use some kind of authenticity_token. On 24.07.2012, at 23:29, Hassan Schroeder wrote:> On Tue, Jul 24, 2012 at 12:09 PM, Valery Kvon <addager-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> If the javascript runtime could do it… :) > > JavaScript? Is this executing on the client or on the server? > > -- > Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > http://about.me/hassanschroeder > twitter: @hassan > > -- > 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@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > >-- 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@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.