Agis A.
2012-Mar-19 15:38 UTC
Visitors must select their city first. How to approach this?
Hi guys. I have an app where visitors can see offers in their cities. So a visitor must select his city first in order to access the app (much like Groupon, using just a cookie though). How should I approach this? I mean,right now what I''m doing is I have the action for the homepage (which lists all offers) and a before_filter applied to it, which redirects the user if no cookie is found. Is this the right way though? -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/Ix1-tYUZO5kJ. 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.
Philip Hallstrom
2012-Mar-19 16:12 UTC
Re: Visitors must select their city first. How to approach this?
> I have an app where visitors can see offers in their cities. So a visitor must select his city first in order to access the app (much like Groupon, using just a cookie though). > > How should I approach this? I mean,right now what I''m doing is I have the action for the homepage (which lists all offers) and a before_filter applied to it, which redirects the user if no cookie is found. Is this the right way though?It would work, but you might look at Maxmind''s geoip lite city database... if no cookie is found, look them up and try to get close. Much nicer experience to say guess their city with a little link to let them change it if you guessed wrong... http://www.maxmind.com/app/geolitecity -philip -- 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.
Colin Law
2012-Mar-19 16:30 UTC
Re: Visitors must select their city first. How to approach this?
On 19 March 2012 15:38, Agis A. <corestudiosinc-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi guys. > > I have an app where visitors can see offers in their cities. So a visitor > must select his city first in order to access the app (much like Groupon, > using just a cookie though). > > How should I approach this? I mean,right now what I''m doing is I have the > action for the homepage (which lists all offers) and a before_filter applied > to it, which redirects the user if no cookie is found. Is this the right way > though?I would do it using the session rather than a cookie (though the same thing underneath of course, but more railsey). Colin -- 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.
Agis A.
2012-Mar-19 17:41 UTC
Re: Visitors must select their city first. How to approach this?
On Monday, March 19, 2012 6:30:35 PM UTC+2, Colin Law wrote:> > On 19 March 2012 15:38, Agis A. <corestudiosinc-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Hi guys. > > > > I have an app where visitors can see offers in their cities. So a visitor > > must select his city first in order to access the app (much like Groupon, > > using just a cookie though). > > > > How should I approach this? I mean,right now what I''m doing is I have the > > action for the homepage (which lists all offers) and a before_filter > applied > > to it, which redirects the user if no cookie is found. Is this the right > way > > though? > > I would do it using the session rather than a cookie (though the same > thing underneath of course, but more railsey). > > Colin >I''m using the cookie rather than session since a user that will set his city for the first time, is unlikely to "change a city". So I suppose that the visitor will always be interested in his City''s offers (well at least until the cookie expires), that''s why I wanted to persist this information. That way, since I don''t have any authentication system, the site always remembers the device''s location so the user doesn''t have to choose the city everytime he closes the browser. What do you think about that? -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/X8QlZdM1hhAJ. 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.
Pravin Mishra
2012-Mar-19 17:56 UTC
Re: Visitors must select their city first. How to approach this?
I think, we can also use http://geokit.rubyforge.org/api/geokit-rails/ (Geokit Plugin: Geocoder, Distance Finders, and more) to get visitor ip, city and country. On 19/03/2012, Agis A. <corestudiosinc-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > On Monday, March 19, 2012 6:30:35 PM UTC+2, Colin Law wrote: >> >> On 19 March 2012 15:38, Agis A. <corestudiosinc-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> > Hi guys. >> > >> > I have an app where visitors can see offers in their cities. So a >> > visitor >> > must select his city first in order to access the app (much like >> > Groupon, >> > using just a cookie though). >> > >> > How should I approach this? I mean,right now what I''m doing is I have >> > the >> > action for the homepage (which lists all offers) and a before_filter >> applied >> > to it, which redirects the user if no cookie is found. Is this the right >> > >> way >> > though? >> >> I would do it using the session rather than a cookie (though the same >> thing underneath of course, but more railsey). >> >> Colin >> > I''m using the cookie rather than session since a user that will set his > city for the first time, is unlikely to "change a city". So I suppose that > the visitor will always be interested in his City''s offers (well at least > until the cookie expires), that''s why I wanted to persist this information. > That way, since I don''t have any authentication system, the site always > remembers the device''s location so the user doesn''t have to choose the city > everytime he closes the browser. > > What do you think about that? > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/rubyonrails-talk/-/X8QlZdM1hhAJ. > 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. > >-- 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.