I''m not sure where my issue is - if it''s in my routes file (maybe I need to be more specific) or if it''s the format of the URL. I am working on a screen scraping project just for fun. It is designed where the URL of the page you are on is passed into the Rails app, so if you are on http://guides.rubyonrails.org/routing.html and click the button for my app, it routes to http://localhost:3000/pages/http%3A%2F%2Fguides.rubyonrails.org%2Frouting.html My routes file has this: resources :pages The problem I face is it works for part of the URL. So if I do: http://localhost:3000/pages/http%3A%2F%2F or http://localhost:3000/pages/http%3A%2F%2Fguides or http://localhost:3000/pages/http%3A%2F%2Fguides.rubyonrails it works. But as soon as I add in the second ''.'', I start getting errors. http://localhost:3000/pages/http%3A%2F%2Fguides.rubyonrails.org gives me: Routing Error No route matches [GET] "/pages/http%3A%2F%2Fguides.rubyonrails.org" Any ideas? -- 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.
Maybe I''m just not getting this, but why wouldn''t you pass the URL as a query string? On Thu, Nov 22, 2012 at 6:58 AM, Dan Brooking <dmbrooking-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I''m not sure where my issue is - if it''s in my routes file (maybe I need to be more specific) or if it''s the format of the URL. > > I am working on a screen scraping project just for fun. It is designed where the URL of the page you are on is passed into the Rails app, so if you are on > http://guides.rubyonrails.org/routing.html > and click the button for my app, it routes to > http://localhost:3000/pages/http%3A%2F%2Fguides.rubyonrails.org%2Frouting.html > > My routes file has this: > > resources :pages > > The problem I face is it works for part of the URL. So if I do: > > http://localhost:3000/pages/http%3A%2F%2F or > http://localhost:3000/pages/http%3A%2F%2Fguides or > http://localhost:3000/pages/http%3A%2F%2Fguides.rubyonrails > > it works. But as soon as I add in the second ''.'', I start getting errors. > > http://localhost:3000/pages/http%3A%2F%2Fguides.rubyonrails.org > > gives me: > > Routing Error > No route matches [GET] "/pages/http%3A%2F%2Fguides.rubyonrails.org" > > Any ideas? > > -- > 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. > >-- 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.
Fairly new to rails so that is a good question :) How would I do that? /pages?url=http://.…. /pages/url=http://.…. Would I need to change the routes any? On Nov 22, 2012, at 8:21 AM, tamouse mailing lists <tamouse.lists-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Maybe I''m just not getting this, but why wouldn''t you pass the URL as > a query string? > > On Thu, Nov 22, 2012 at 6:58 AM, Dan Brooking <dmbrooking-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> I''m not sure where my issue is - if it''s in my routes file (maybe I need to be more specific) or if it''s the format of the URL. >> >> I am working on a screen scraping project just for fun. It is designed where the URL of the page you are on is passed into the Rails app, so if you are on >> http://guides.rubyonrails.org/routing.html >> and click the button for my app, it routes to >> http://localhost:3000/pages/http%3A%2F%2Fguides.rubyonrails.org%2Frouting.html >> >> My routes file has this: >> >> resources :pages >> >> The problem I face is it works for part of the URL. So if I do: >> >> http://localhost:3000/pages/http%3A%2F%2F or >> http://localhost:3000/pages/http%3A%2F%2Fguides or >> http://localhost:3000/pages/http%3A%2F%2Fguides.rubyonrails >> >> it works. But as soon as I add in the second ''.'', I start getting errors. >> >> http://localhost:3000/pages/http%3A%2F%2Fguides.rubyonrails.org >> >> gives me: >> >> Routing Error >> No route matches [GET] "/pages/http%3A%2F%2Fguides.rubyonrails.org" >> >> Any ideas? >> >> -- >> 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. >> >> > > -- > 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.
On Thu, Nov 22, 2012 at 6:58 AM, Dan Brooking <dmbrooking-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: __SNIP__> The problem I face is it works for part of the URL. So if I do: > http://localhost:3000/pages/http%3A%2F%2F or > http://localhost:3000/pages/http%3A%2F%2Fguides or > http://localhost:3000/pages/http%3A%2F%2Fguides.rubyonrails > it works. But as soon as I add in the second ''.'', I start getting errors. > http://localhost:3000/pages/http%3A%2F%2Fguides.rubyonrails.org > gives me: > Routing Error > No route matches [GET] "/pages/http%3A%2F%2Fguides.rubyonrails.org" > Any ideas?get "/pages/:page" => "controller#page", value: /.*/ Notice the "value: /.*/". -- 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.
Jordan''s answer notwithstanding, On Thu, Nov 22, 2012 at 7:25 AM, Dan Brooking <dmbrooking-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Fairly new to rails so that is a good question :) > > How would I do that? > > /pages?url=http://.….This is the format that will give you a query string.> /pages/url=http://.….This form would need to be handled in routes in a manner similar to the answer Jordan gave.> Would I need to change the routes any? > > > On Nov 22, 2012, at 8:21 AM, tamouse mailing lists <tamouse.lists@gmail.com> wrote: > >> Maybe I''m just not getting this, but why wouldn''t you pass the URL as >> a query string? >> >> On Thu, Nov 22, 2012 at 6:58 AM, Dan Brooking <dmbrooking-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >>> I''m not sure where my issue is - if it''s in my routes file (maybe I need to be more specific) or if it''s the format of the URL. >>> >>> I am working on a screen scraping project just for fun. It is designed where the URL of the page you are on is passed into the Rails app, so if you are on >>> http://guides.rubyonrails.org/routing.html >>> and click the button for my app, it routes to >>> http://localhost:3000/pages/http%3A%2F%2Fguides.rubyonrails.org%2Frouting.html >>> >>> My routes file has this: >>> >>> resources :pages >>> >>> The problem I face is it works for part of the URL. So if I do: >>> >>> http://localhost:3000/pages/http%3A%2F%2F or >>> http://localhost:3000/pages/http%3A%2F%2Fguides or >>> http://localhost:3000/pages/http%3A%2F%2Fguides.rubyonrails >>> >>> it works. But as soon as I add in the second ''.'', I start getting errors. >>> >>> http://localhost:3000/pages/http%3A%2F%2Fguides.rubyonrails.org >>> >>> gives me: >>> >>> Routing Error >>> No route matches [GET] "/pages/http%3A%2F%2Fguides.rubyonrails.org" >>> >>> Any ideas? >>> >>> -- >>> 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. >>> >>> >> >> -- >> 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. >> >> > > -- > 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.
On Nov 22, 2012, at 8:33 AM, tamouse mailing lists <tamouse.lists-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Jordan''s answer notwithstanding, >I tried that and it didn''t work. I understand what it''s trying to do so I''ll keep playing with it to get it working. I did use the url param method you have below and that is working. On a side note - is either one considered to be a better way to do it? Or just two different ways of solving the same problem? Is there a length limit to URL params that I might run into?> On Thu, Nov 22, 2012 at 7:25 AM, Dan Brooking <dmbrooking-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> Fairly new to rails so that is a good question :) >> >> How would I do that? >> >> /pages?url=http://.…. > > This is the format that will give you a query string >> /pages/url=http://.…. > > This form would need to be handled in routes in a manner similar to > the answer Jordan gave. > >> Would I need to change the routes any? >> >> >> On Nov 22, 2012, at 8:21 AM, tamouse mailing lists <tamouse.lists@gmail.com> wrote: >> >>> Maybe I''m just not getting this, but why wouldn''t you pass the URL as >>> a query string? >>> >>> On Thu, Nov 22, 2012 at 6:58 AM, Dan Brooking <dmbrooking-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >>>> I''m not sure where my issue is - if it''s in my routes file (maybe I need to be more specific) or if it''s the format of the URL. >>>> >>>> I am working on a screen scraping project just for fun. It is designed where the URL of the page you are on is passed into the Rails app, so if you are on >>>> http://guides.rubyonrails.org/routing.html >>>> and click the button for my app, it routes to >>>> http://localhost:3000/pages/http%3A%2F%2Fguides.rubyonrails.org%2Frouting.html >>>> >>>> My routes file has this: >>>> >>>> resources :pages >>>> >>>> The problem I face is it works for part of the URL. So if I do: >>>> >>>> http://localhost:3000/pages/http%3A%2F%2F or >>>> http://localhost:3000/pages/http%3A%2F%2Fguides or >>>> http://localhost:3000/pages/http%3A%2F%2Fguides.rubyonrails >>>> >>>> it works. But as soon as I add in the second ''.'', I start getting errors. >>>> >>>> http://localhost:3000/pages/http%3A%2F%2Fguides.rubyonrails.org >>>> >>>> gives me: >>>> >>>> Routing Error >>>> No route matches [GET] "/pages/http%3A%2F%2Fguides.rubyonrails.org" >>>> >>>> Any ideas? >>>> >>>> -- >>>> 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-/JYPxA39Uh5TLH3MbocFFw@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. >>>> >>>> >>> >>> -- >>> 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. >>> >>> >> >> -- >> 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. >> >> > > -- > 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.