Josh Sharpe
2008-Dec-02 17:43 UTC
[Facebooker-talk] mapping callback url to the correct controller
First off, our default route is: map.connect '':locale/:controller/:action/:id'' So I created a facebook controller which can be accessed at /en/facebook/ and I set up the callbackURL to be http://www.domain.com/en/facebook. This works and pulls up my index page just fine. But when I create a really simple link on that page: <%= link_to "Something Else", :action => :something %> It links to: /en/facebook/en/facebook/something and I obviously get a Routing error. So I tried to set up some routes.rb trickery: map.connect "/en/facebook/:locale/:controller/:action/:id" map.connect "/en/facebook/:locale/:controller/:action" This makes links point to: /en/facebook/en/facebook/en/facebook/something So there is some kind of circular action going on here. Any suggestions on how I can get out of this? -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/facebooker-talk/attachments/20081202/48a74989/attachment.html>
Stéphane Akkaoui
2008-Dec-02 17:52 UTC
[Facebooker-talk] mapping callback url to the correct controller
Le 2 d?c. 08 ? 18:43, Josh Sharpe a ?crit :> First off, our default route is: > map.connect '':locale/:controller/:action/:id'' > > So I created a facebook controller which can be accessed at /en/ > facebook/ and I set up the callbackURL to be http://www.domain.com/en/facebook > .I think the mistake is here. Since your rails app run under http://www.domain.com/, why do you add en/facebook to your callback url ? If you do so, facebook will ad all routes to this and it will append what you says : http://www.domain.com/en/facebook/en/facebook/something> > This works and pulls up my index page just fine. But when I create > a really simple link on that page: > > <%= link_to "Something Else", :action => :something %> > > It links to: /en/facebook/en/facebook/something and I obviously get > a Routing error. > > So I tried to set up some routes.rb trickery: > > map.connect "/en/facebook/:locale/:controller/:action/:id" > map.connect "/en/facebook/:locale/:controller/:action" > > This makes links point to: > /en/facebook/en/facebook/en/facebook/something > > So there is some kind of circular action going on here. > > Any suggestions on how I can get out of this? > _______________________________________________ > Facebooker-talk mailing list > Facebooker-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/facebooker-talk
Josh Sharpe
2008-Dec-02 18:07 UTC
[Facebooker-talk] mapping callback url to the correct controller
Yea, our entire app is at root, but I can''t point my facebook app to that, I want to point it right at the facebook controller. On Tue, Dec 2, 2008 at 12:52 PM, St?phane Akkaoui < stephane.akkaoui at imeuble.info> wrote:> > Le 2 d?c. 08 ? 18:43, Josh Sharpe a ?crit : > > First off, our default route is: >> map.connect '':locale/:controller/:action/:id'' >> >> So I created a facebook controller which can be accessed at /en/facebook/ >> and I set up the callbackURL to be http://www.domain.com/en/facebook. >> > > I think the mistake is here. > Since your rails app run under http://www.domain.com/, why do you add > en/facebook to your callback url ? > If you do so, facebook will ad all routes to this and it will append what > you says : http://www.domain.com/en/facebook/en/facebook/something > > > >> This works and pulls up my index page just fine. But when I create a >> really simple link on that page: >> >> <%= link_to "Something Else", :action => :something %> >> >> It links to: /en/facebook/en/facebook/something and I obviously get a >> Routing error. >> >> So I tried to set up some routes.rb trickery: >> >> map.connect "/en/facebook/:locale/:controller/:action/:id" >> map.connect "/en/facebook/:locale/:controller/:action" >> >> This makes links point to: >> /en/facebook/en/facebook/en/facebook/something >> >> So there is some kind of circular action going on here. >> >> Any suggestions on how I can get out of this? >> _______________________________________________ >> Facebooker-talk mailing list >> Facebooker-talk at rubyforge.org >> http://rubyforge.org/mailman/listinfo/facebooker-talk >> > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/facebooker-talk/attachments/20081202/01c39a58/attachment.html>
Mike Mangino
2008-Dec-02 19:04 UTC
[Facebooker-talk] mapping callback url to the correct controller
On Dec 2, 2008, at 1:07 PM, Josh Sharpe wrote:> Yea, our entire app is at root, but I can''t point my facebook app to > that, I want to point it right at the facebook controller.Why not? I would just add a before filter on the application controller that redirects requests to your facebook controller, then skip the filter on that. Facebooker doesn''t work with a callback url that points to anything but the root path. Mike> > > On Tue, Dec 2, 2008 at 12:52 PM, St?phane Akkaoui <stephane.akkaoui at imeuble.info > > wrote: > > Le 2 d?c. 08 ? 18:43, Josh Sharpe a ?crit : > > > First off, our default route is: > map.connect '':locale/:controller/:action/:id'' > > So I created a facebook controller which can be accessed at /en/ > facebook/ and I set up the callbackURL to be http://www.domain.com/en/facebook > . > > I think the mistake is here. > Since your rails app run under http://www.domain.com/, why do you > add en/facebook to your callback url ? > If you do so, facebook will ad all routes to this and it will append > what you says : http://www.domain.com/en/facebook/en/facebook/something > > > > This works and pulls up my index page just fine. But when I create > a really simple link on that page: > > <%= link_to "Something Else", :action => :something %> > > It links to: /en/facebook/en/facebook/something and I obviously get > a Routing error. > > So I tried to set up some routes.rb trickery: > > map.connect "/en/facebook/:locale/:controller/:action/:id" > map.connect "/en/facebook/:locale/:controller/:action" > > This makes links point to: > /en/facebook/en/facebook/en/facebook/something > > So there is some kind of circular action going on here. > > Any suggestions on how I can get out of this? > _______________________________________________ > Facebooker-talk mailing list > Facebooker-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/facebooker-talk > > > _______________________________________________ > Facebooker-talk mailing list > Facebooker-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/facebooker-talk-- Mike Mangino http://www.elevatedrails.com
Josh Sharpe
2008-Dec-02 19:07 UTC
[Facebooker-talk] mapping callback url to the correct controller
How would you identify a facebook app versus any other request? On Tue, Dec 2, 2008 at 2:04 PM, Mike Mangino <mmangino at elevatedrails.com>wrote:> > On Dec 2, 2008, at 1:07 PM, Josh Sharpe wrote: > > Yea, our entire app is at root, but I can''t point my facebook app to that, >> I want to point it right at the facebook controller. >> > > Why not? I would just add a before filter on the application controller > that redirects requests to your facebook controller, then skip the filter on > that. Facebooker doesn''t work with a callback url that points to anything > but the root path. > > Mike > > > > >> >> On Tue, Dec 2, 2008 at 12:52 PM, St?phane Akkaoui < >> stephane.akkaoui at imeuble.info> wrote: >> >> Le 2 d?c. 08 ? 18:43, Josh Sharpe a ?crit : >> >> >> First off, our default route is: >> map.connect '':locale/:controller/:action/:id'' >> >> So I created a facebook controller which can be accessed at /en/facebook/ >> and I set up the callbackURL to be http://www.domain.com/en/facebook. >> >> I think the mistake is here. >> Since your rails app run under http://www.domain.com/, why do you add >> en/facebook to your callback url ? >> If you do so, facebook will ad all routes to this and it will append what >> you says : http://www.domain.com/en/facebook/en/facebook/something >> >> >> >> This works and pulls up my index page just fine. But when I create a >> really simple link on that page: >> >> <%= link_to "Something Else", :action => :something %> >> >> It links to: /en/facebook/en/facebook/something and I obviously get a >> Routing error. >> >> So I tried to set up some routes.rb trickery: >> >> map.connect "/en/facebook/:locale/:controller/:action/:id" >> map.connect "/en/facebook/:locale/:controller/:action" >> >> This makes links point to: >> /en/facebook/en/facebook/en/facebook/something >> >> So there is some kind of circular action going on here. >> >> Any suggestions on how I can get out of this? >> _______________________________________________ >> Facebooker-talk mailing list >> Facebooker-talk at rubyforge.org >> http://rubyforge.org/mailman/listinfo/facebooker-talk >> >> >> _______________________________________________ >> Facebooker-talk mailing list >> Facebooker-talk at rubyforge.org >> http://rubyforge.org/mailman/listinfo/facebooker-talk >> > > -- > Mike Mangino > http://www.elevatedrails.com > > > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/facebooker-talk/attachments/20081202/8d2cc0c5/attachment-0001.html>
Mike Mangino
2008-Dec-02 20:25 UTC
[Facebooker-talk] mapping callback url to the correct controller
Facebook sends a whole host of parameters to you. You can look at those and make the determination. Facebooker adds a request_if_from_facebook? method to the controller I believe. Mike On Dec 2, 2008, at 2:07 PM, Josh Sharpe wrote:> How would you identify a facebook app versus any other request? > > On Tue, Dec 2, 2008 at 2:04 PM, Mike Mangino <mmangino at elevatedrails.com > > wrote: > > On Dec 2, 2008, at 1:07 PM, Josh Sharpe wrote: > > Yea, our entire app is at root, but I can''t point my facebook app to > that, I want to point it right at the facebook controller. > > Why not? I would just add a before filter on the application > controller that redirects requests to your facebook controller, then > skip the filter on that. Facebooker doesn''t work with a callback url > that points to anything but the root path. > > Mike > > > > > > On Tue, Dec 2, 2008 at 12:52 PM, St?phane Akkaoui <stephane.akkaoui at imeuble.info > > wrote: > > Le 2 d?c. 08 ? 18:43, Josh Sharpe a ?crit : > > > First off, our default route is: > map.connect '':locale/:controller/:action/:id'' > > So I created a facebook controller which can be accessed at /en/ > facebook/ and I set up the callbackURL to be http://www.domain.com/en/facebook > . > > I think the mistake is here. > Since your rails app run under http://www.domain.com/, why do you > add en/facebook to your callback url ? > If you do so, facebook will ad all routes to this and it will append > what you says : http://www.domain.com/en/facebook/en/facebook/something > > > > This works and pulls up my index page just fine. But when I create > a really simple link on that page: > > <%= link_to "Something Else", :action => :something %> > > It links to: /en/facebook/en/facebook/something and I obviously get > a Routing error. > > So I tried to set up some routes.rb trickery: > > map.connect "/en/facebook/:locale/:controller/:action/:id" > map.connect "/en/facebook/:locale/:controller/:action" > > This makes links point to: > /en/facebook/en/facebook/en/facebook/something > > So there is some kind of circular action going on here. > > Any suggestions on how I can get out of this? > _______________________________________________ > Facebooker-talk mailing list > Facebooker-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/facebooker-talk > > > _______________________________________________ > Facebooker-talk mailing list > Facebooker-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/facebooker-talk > > -- > Mike Mangino > http://www.elevatedrails.com > > > >-- Mike Mangino http://www.elevatedrails.com