Jonathan Otto
2008-Mar-10 18:45 UTC
[Facebooker-talk] facebooker is rewriting URLs even off of facebook canvas
The URLs for CSS/JS files are being rewritten to the address specified in the tunnel even when outside of the facebook canvas. Is anyone else having this problem?
Christopher Bailey
2008-Mar-10 18:50 UTC
[Facebooker-talk] facebooker is rewriting URLs even off of facebook canvas
Yes, see my prior thread about it. What version of Rails are you using? I''m having this issue with Rails 1.2.x, whereas Mike has said he doesn''t have the problem in Rails 2.x. I assume you are putting ":canvas=>false" as a parameter when generating the URL? On 3/10/08, Jonathan Otto <jonathan.otto at gmail.com> wrote:> > The URLs for CSS/JS files are being rewritten to the address specified > in the tunnel even when outside of the facebook canvas. Is anyone else > having this problem? > _______________________________________________ > Facebooker-talk mailing list > Facebooker-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/facebooker-talk >-- Christopher Bailey Cobalt Edge LLC http://cobaltedge.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/facebooker-talk/attachments/20080310/33b203ee/attachment.html
Jonathan Otto
2008-Mar-10 18:52 UTC
[Facebooker-talk] facebooker is rewriting URLs even off of facebook canvas
was not using canvs false. i am on 2.0.2 On Mon, Mar 10, 2008 at 1:50 PM, Christopher Bailey <chris at cobaltedge.com> wrote:> Yes, see my prior thread about it. What version of Rails are you using? > I''m having this issue with Rails 1.2.x, whereas Mike has said he doesn''t > have the problem in Rails 2.x. I assume you are putting ":canvas=>false" as > a parameter when generating the URL? > > > > On 3/10/08, Jonathan Otto <jonathan.otto at gmail.com> wrote: > > > > > > > > The URLs for CSS/JS files are being rewritten to the address specified > > in the tunnel even when outside of the facebook canvas. Is anyone else > > having this problem? > > _______________________________________________ > > Facebooker-talk mailing list > > Facebooker-talk at rubyforge.org > > http://rubyforge.org/mailman/listinfo/facebooker-talk > > > > > > -- > Christopher Bailey > Cobalt Edge LLC > http://cobaltedge.com
Christopher Bailey
2008-Mar-10 19:15 UTC
[Facebooker-talk] facebooker is rewriting URLs even off of facebook canvas
Ya, so, say you are doing url_for or link_to, or any named route, you want to add ":canvas => false" to the list of options when generating the URL. That will tell it to make the URL point to your external site. It works the other way as well, to generate one into Facebook space, by setting canvas to true. On 3/10/08, Jonathan Otto <jonathan.otto at gmail.com> wrote:> > was not using canvs false. i am on 2.0.2 > > > On Mon, Mar 10, 2008 at 1:50 PM, Christopher Bailey > <chris at cobaltedge.com> wrote: > > Yes, see my prior thread about it. What version of Rails are you using? > > I''m having this issue with Rails 1.2.x, whereas Mike has said he doesn''t > > have the problem in Rails 2.x. I assume you are putting > ":canvas=>false" as > > a parameter when generating the URL? > > > > > > > > On 3/10/08, Jonathan Otto <jonathan.otto at gmail.com> wrote: > > > > > > > > > > > > The URLs for CSS/JS files are being rewritten to the address specified > > > in the tunnel even when outside of the facebook canvas. Is anyone else > > > having this problem? > > > _______________________________________________ > > > Facebooker-talk mailing list > > > Facebooker-talk at rubyforge.org > > > http://rubyforge.org/mailman/listinfo/facebooker-talk > > > > > > > > > > > -- > > Christopher Bailey > > Cobalt Edge LLC > > http://cobaltedge.com >-- Christopher Bailey Cobalt Edge LLC http://cobaltedge.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/facebooker-talk/attachments/20080310/0fc9203a/attachment.html
Christopher Bailey
2008-Mar-10 19:59 UTC
[Facebooker-talk] facebooker is rewriting URLs even off of facebook canvas
It can''t - it has no way of knowing whether the URL should be for within Facebook or outside. Many folks have controllers and actions that work in both, and it just depends on the format, or various other things. It might be nice to have a mechanism to say: only routes for this controller are within Facebook, assume everything else is outside, as say a configuration option or some such, but that is not consistent across people''s app''s. It would work for my app, and I''ve considered doing that exact kind of modification for our code, but haven''t gotten around to it yet. If I do, I''ll post my solution. On 3/10/08, Jonathan Otto <jonathan.otto at gmail.com> wrote:> > Yeah, that seems kind of excessive no? I''m reading through all of the > old discussion, trying to figure out why the facebook_url_rewriting.rb > file is not working correctly. When not in the canvas it should > automatically use the normal rails routes. > > On Mon, Mar 10, 2008 at 2:15 PM, Christopher Bailey > > <chris at cobaltedge.com> wrote: > > Ya, so, say you are doing url_for or link_to, or any named route, you > want > > to add ":canvas => false" to the list of options when generating the > URL. > > That will tell it to make the URL point to your external site. It works > the > > other way as well, to generate one into Facebook space, by setting > canvas to > > true. > > > > > > On 3/10/08, Jonathan Otto <jonathan.otto at gmail.com> wrote: > > > was not using canvs false. i am on 2.0.2 > > > > > > > > > On Mon, Mar 10, 2008 at 1:50 PM, Christopher Bailey > > > <chris at cobaltedge.com> wrote: > > > > Yes, see my prior thread about it. What version of Rails are you > using? > > > > I''m having this issue with Rails 1.2.x, whereas Mike has said he > doesn''t > > > > have the problem in Rails 2.x. I assume you are putting > > ":canvas=>false" as > > > > a parameter when generating the URL? > > > > > > > > > > > > > > > > On 3/10/08, Jonathan Otto <jonathan.otto at gmail.com> wrote: > > > > > > > > > > > > > > > > > > > > The URLs for CSS/JS files are being rewritten to the address > specified > > > > > in the tunnel even when outside of the facebook canvas. Is anyone > else > > > > > having this problem? > > > > > _______________________________________________ > > > > > Facebooker-talk mailing list > > > > > Facebooker-talk at rubyforge.org > > > > > http://rubyforge.org/mailman/listinfo/facebooker-talk > > > > > > > > > > > > > > > > > > > > > -- > > > > Christopher Bailey > > > > Cobalt Edge LLC > > > > http://cobaltedge.com > > > > > > > > > > > -- > > > > Christopher Bailey > > Cobalt Edge LLC > > http://cobaltedge.com >-- Christopher Bailey Cobalt Edge LLC http://cobaltedge.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/facebooker-talk/attachments/20080310/80d4fa6d/attachment.html
Jonathan Otto
2008-Mar-10 20:02 UTC
[Facebooker-talk] facebooker is rewriting URLs even off of facebook canvas
Shouldn''t be as simple as testing for one of the usual POST params that comes from Facebook? On Mon, Mar 10, 2008 at 2:59 PM, Christopher Bailey <chris at cobaltedge.com> wrote:> It can''t - it has no way of knowing whether the URL should be for within > Facebook or outside. Many folks have controllers and actions that work in > both, and it just depends on the format, or various other things. > > > It might be nice to have a mechanism to say: only routes for this controller > are within Facebook, assume everything else is outside, as say a > configuration option or some such, but that is not consistent across > people''s app''s. It would work for my app, and I''ve considered doing that > exact kind of modification for our code, but haven''t gotten around to it > yet. If I do, I''ll post my solution. > > > > On 3/10/08, Jonathan Otto <jonathan.otto at gmail.com> wrote: > > Yeah, that seems kind of excessive no? I''m reading through all of the > > old discussion, trying to figure out why the facebook_url_rewriting.rb > > file is not working correctly. When not in the canvas it should > > automatically use the normal rails routes. > > > > On Mon, Mar 10, 2008 at 2:15 PM, Christopher Bailey > > > > <chris at cobaltedge.com> wrote: > > > Ya, so, say you are doing url_for or link_to, or any named route, you > want > > > to add ":canvas => false" to the list of options when generating the > URL. > > > That will tell it to make the URL point to your external site. It works > the > > > other way as well, to generate one into Facebook space, by setting > canvas to > > > true. > > > > > > > > > On 3/10/08, Jonathan Otto <jonathan.otto at gmail.com> wrote: > > > > was not using canvs false. i am on 2.0.2 > > > > > > > > > > > > On Mon, Mar 10, 2008 at 1:50 PM, Christopher Bailey > > > > <chris at cobaltedge.com> wrote: > > > > > Yes, see my prior thread about it. What version of Rails are you > using? > > > > > I''m having this issue with Rails 1.2.x, whereas Mike has said he > doesn''t > > > > > have the problem in Rails 2.x. I assume you are putting > > > ":canvas=>false" as > > > > > a parameter when generating the URL? > > > > > > > > > > > > > > > > > > > > On 3/10/08, Jonathan Otto <jonathan.otto at gmail.com> wrote: > > > > > > > > > > > > > > > > > > > > > > > > The URLs for CSS/JS files are being rewritten to the address > specified > > > > > > in the tunnel even when outside of the facebook canvas. Is anyone > else > > > > > > having this problem? > > > > > > _______________________________________________ > > > > > > Facebooker-talk mailing list > > > > > > Facebooker-talk at rubyforge.org > > > > > > http://rubyforge.org/mailman/listinfo/facebooker-talk > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > Christopher Bailey > > > > > Cobalt Edge LLC > > > > > http://cobaltedge.com > > > > > > > > > > > > > > > > -- > > > > > > Christopher Bailey > > > Cobalt Edge LLC > > > http://cobaltedge.com > > > > > > -- > Christopher Bailey > Cobalt Edge LLC > http://cobaltedge.com
Christopher Bailey
2008-Mar-10 20:11 UTC
[Facebooker-talk] facebooker is rewriting URLs even off of facebook canvas
That won''t cover all your needs. Here''s an example: say you have a set of navigation links or tabs across the top of your Facebook app. One of those might actually be a link to your external site. Yet, at the time those links are generated, you are in the context of Facebook, so now your link will not be correctly pointed to your external site. Our app is primarily its own web app, but we have (well, it''ll be public soon, but not yet :) a Facebook app that is mixed in to our main app, and both the web app and the Facebook app have links back and forth to each other. So, in both cases, I need to be able to say, during a single request, this link is for Facebook, and this other link is not, etc. On 3/10/08, Jonathan Otto <jonathan.otto at gmail.com> wrote:> > Shouldn''t be as simple as testing for one of the usual POST params > that comes from Facebook? > > On Mon, Mar 10, 2008 at 2:59 PM, Christopher Bailey > > <chris at cobaltedge.com> wrote: > > It can''t - it has no way of knowing whether the URL should be for within > > Facebook or outside. Many folks have controllers and actions that work > in > > both, and it just depends on the format, or various other things. > > > > > > It might be nice to have a mechanism to say: only routes for this > controller > > are within Facebook, assume everything else is outside, as say a > > configuration option or some such, but that is not consistent across > > people''s app''s. It would work for my app, and I''ve considered doing > that > > exact kind of modification for our code, but haven''t gotten around to it > > yet. If I do, I''ll post my solution. > > > > > > > > On 3/10/08, Jonathan Otto <jonathan.otto at gmail.com> wrote: > > > Yeah, that seems kind of excessive no? I''m reading through all of the > > > old discussion, trying to figure out why the facebook_url_rewriting.rb > > > file is not working correctly. When not in the canvas it should > > > automatically use the normal rails routes. > > > > > > On Mon, Mar 10, 2008 at 2:15 PM, Christopher Bailey > > > > > > <chris at cobaltedge.com> wrote: > > > > Ya, so, say you are doing url_for or link_to, or any named route, > you > > want > > > > to add ":canvas => false" to the list of options when generating the > > URL. > > > > That will tell it to make the URL point to your external site. It > works > > the > > > > other way as well, to generate one into Facebook space, by setting > > canvas to > > > > true. > > > > > > > > > > > > On 3/10/08, Jonathan Otto <jonathan.otto at gmail.com> wrote: > > > > > was not using canvs false. i am on 2.0.2 > > > > > > > > > > > > > > > On Mon, Mar 10, 2008 at 1:50 PM, Christopher Bailey > > > > > <chris at cobaltedge.com> wrote: > > > > > > Yes, see my prior thread about it. What version of Rails are > you > > using? > > > > > > I''m having this issue with Rails 1.2.x, whereas Mike has said he > > doesn''t > > > > > > have the problem in Rails 2.x. I assume you are putting > > > > ":canvas=>false" as > > > > > > a parameter when generating the URL? > > > > > > > > > > > > > > > > > > > > > > > > On 3/10/08, Jonathan Otto <jonathan.otto at gmail.com> wrote: > > > > > > > > > > > > > > > > > > > > > > > > > > > > The URLs for CSS/JS files are being rewritten to the address > > specified > > > > > > > in the tunnel even when outside of the facebook canvas. Is > anyone > > else > > > > > > > having this problem? > > > > > > > _______________________________________________ > > > > > > > Facebooker-talk mailing list > > > > > > > Facebooker-talk at rubyforge.org > > > > > > > http://rubyforge.org/mailman/listinfo/facebooker-talk > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > > Christopher Bailey > > > > > > Cobalt Edge LLC > > > > > > http://cobaltedge.com > > > > > > > > > > > > > > > > > > > > > -- > > > > > > > > Christopher Bailey > > > > Cobalt Edge LLC > > > > http://cobaltedge.com > > > > > > > > > > > -- > > Christopher Bailey > > Cobalt Edge LLC > > http://cobaltedge.com >-- Christopher Bailey Cobalt Edge LLC http://cobaltedge.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/facebooker-talk/attachments/20080310/7bb9c122/attachment-0001.html
Jonathan Otto
2008-Mar-10 20:25 UTC
[Facebooker-talk] facebooker is rewriting URLs even off of facebook canvas
Agreed. Still, there are situations where I want the apps to be separate - but from the same code (with the exception of the views). On Mon, Mar 10, 2008 at 3:11 PM, Christopher Bailey <chris at cobaltedge.com> wrote:> That won''t cover all your needs. Here''s an example: say you have a set of > navigation links or tabs across the top of your Facebook app. One of those > might actually be a link to your external site. Yet, at the time those > links are generated, you are in the context of Facebook, so now your link > will not be correctly pointed to your external site. > > > Our app is primarily its own web app, but we have (well, it''ll be public > soon, but not yet :) a Facebook app that is mixed in to our main app, and > both the web app and the Facebook app have links back and forth to each > other. So, in both cases, I need to be able to say, during a single > request, this link is for Facebook, and this other link is not, etc. > > > > On 3/10/08, Jonathan Otto <jonathan.otto at gmail.com> wrote: > > Shouldn''t be as simple as testing for one of the usual POST params > > that comes from Facebook? > > > > On Mon, Mar 10, 2008 at 2:59 PM, Christopher Bailey > > > > <chris at cobaltedge.com> wrote: > > > It can''t - it has no way of knowing whether the URL should be for within > > > Facebook or outside. Many folks have controllers and actions that work > in > > > both, and it just depends on the format, or various other things. > > > > > > > > > It might be nice to have a mechanism to say: only routes for this > controller > > > are within Facebook, assume everything else is outside, as say a > > > configuration option or some such, but that is not consistent across > > > people''s app''s. It would work for my app, and I''ve considered doing > that > > > exact kind of modification for our code, but haven''t gotten around to it > > > yet. If I do, I''ll post my solution. > > > > > > > > > > > > On 3/10/08, Jonathan Otto <jonathan.otto at gmail.com> wrote: > > > > Yeah, that seems kind of excessive no? I''m reading through all of the > > > > old discussion, trying to figure out why the facebook_url_rewriting.rb > > > > file is not working correctly. When not in the canvas it should > > > > automatically use the normal rails routes. > > > > > > > > On Mon, Mar 10, 2008 at 2:15 PM, Christopher Bailey > > > > > > > > <chris at cobaltedge.com> wrote: > > > > > Ya, so, say you are doing url_for or link_to, or any named route, > you > > > want > > > > > to add ":canvas => false" to the list of options when generating the > > > URL. > > > > > That will tell it to make the URL point to your external site. It > works > > > the > > > > > other way as well, to generate one into Facebook space, by setting > > > canvas to > > > > > true. > > > > > > > > > > > > > > > On 3/10/08, Jonathan Otto <jonathan.otto at gmail.com> wrote: > > > > > > was not using canvs false. i am on 2.0.2 > > > > > > > > > > > > > > > > > > On Mon, Mar 10, 2008 at 1:50 PM, Christopher Bailey > > > > > > <chris at cobaltedge.com> wrote: > > > > > > > Yes, see my prior thread about it. What version of Rails are > you > > > using? > > > > > > > I''m having this issue with Rails 1.2.x, whereas Mike has said he > > > doesn''t > > > > > > > have the problem in Rails 2.x. I assume you are putting > > > > > ":canvas=>false" as > > > > > > > a parameter when generating the URL? > > > > > > > > > > > > > > > > > > > > > > > > > > > > On 3/10/08, Jonathan Otto <jonathan.otto at gmail.com> wrote: > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > The URLs for CSS/JS files are being rewritten to the address > > > specified > > > > > > > > in the tunnel even when outside of the facebook canvas. Is > anyone > > > else > > > > > > > > having this problem? > > > > > > > > _______________________________________________ > > > > > > > > Facebooker-talk mailing list > > > > > > > > Facebooker-talk at rubyforge.org > > > > > > > > http://rubyforge.org/mailman/listinfo/facebooker-talk > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > > > Christopher Bailey > > > > > > > Cobalt Edge LLC > > > > > > > http://cobaltedge.com > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > > > > > > Christopher Bailey > > > > > Cobalt Edge LLC > > > > > http://cobaltedge.com > > > > > > > > > > > > > > > > -- > > > Christopher Bailey > > > Cobalt Edge LLC > > > http://cobaltedge.com > > > > > > -- > Christopher Bailey > Cobalt Edge LLC > http://cobaltedge.com
Christopher Bailey
2008-Mar-10 21:02 UTC
[Facebooker-talk] facebooker is rewriting URLs even off of facebook canvas
I''m not sure I understand the distinction. The app I''m working on is different, in that I have a single controller that handles all our needs for Facebook (our Facebook app is not big), and then many many other controllers that handle our regular web app - all in the same code base. If your app only differs by the views it renders, then that''s even tighter, and you likely are controlling your output by format or similar. In that case it''s technically even harder to discern where a URL goes, because you''ve got the same controlling pulling double duty. Basically, IMHO, what it comes down to, is what is your way of distinguishing where a URL is destined for. If you know all URL''s for certain controller(s) go to FB, then you could do a solution based on that. If you mix and match, then you have to find another criteria. The canvas option, when generating URL''s provides a generalized solution for all this, and handles the edge cases, where you want to generate a URL that goes is not for the context you are in (e.g. you want a URL that goes to your external web app, yet the current request is within your Facebook app, or vice versa). You shouldn''t have to use it that often, so it seems like a fairly easy solution, and low impact. On 3/10/08, Jonathan Otto <jonathan.otto at gmail.com> wrote:> > Agreed. Still, there are situations where I want the apps to be > separate - but from the same code (with the exception of the views). > > On Mon, Mar 10, 2008 at 3:11 PM, Christopher Bailey > > <chris at cobaltedge.com> wrote: > > That won''t cover all your needs. Here''s an example: say you have a set > of > > navigation links or tabs across the top of your Facebook app. One of > those > > might actually be a link to your external site. Yet, at the time those > > links are generated, you are in the context of Facebook, so now your > link > > will not be correctly pointed to your external site. > > > > > > Our app is primarily its own web app, but we have (well, it''ll be public > > soon, but not yet :) a Facebook app that is mixed in to our main app, > and > > both the web app and the Facebook app have links back and forth to each > > other. So, in both cases, I need to be able to say, during a single > > request, this link is for Facebook, and this other link is not, etc. > > > > > > > > On 3/10/08, Jonathan Otto <jonathan.otto at gmail.com> wrote: > > > Shouldn''t be as simple as testing for one of the usual POST params > > > that comes from Facebook? > > > > > > On Mon, Mar 10, 2008 at 2:59 PM, Christopher Bailey > > > > > > <chris at cobaltedge.com> wrote: > > > > It can''t - it has no way of knowing whether the URL should be for > within > > > > Facebook or outside. Many folks have controllers and actions that > work > > in > > > > both, and it just depends on the format, or various other things. > > > > > > > > > > > > It might be nice to have a mechanism to say: only routes for this > > controller > > > > are within Facebook, assume everything else is outside, as say a > > > > configuration option or some such, but that is not consistent across > > > > people''s app''s. It would work for my app, and I''ve considered doing > > that > > > > exact kind of modification for our code, but haven''t gotten around > to it > > > > yet. If I do, I''ll post my solution. > > > > > > > > > > > > > > > > On 3/10/08, Jonathan Otto <jonathan.otto at gmail.com> wrote: > > > > > Yeah, that seems kind of excessive no? I''m reading through all of > the > > > > > old discussion, trying to figure out why the > facebook_url_rewriting.rb > > > > > file is not working correctly. When not in the canvas it should > > > > > automatically use the normal rails routes. > > > > > > > > > > On Mon, Mar 10, 2008 at 2:15 PM, Christopher Bailey > > > > > > > > > > <chris at cobaltedge.com> wrote: > > > > > > Ya, so, say you are doing url_for or link_to, or any named > route, > > you > > > > want > > > > > > to add ":canvas => false" to the list of options when generating > the > > > > URL. > > > > > > That will tell it to make the URL point to your external > site. It > > works > > > > the > > > > > > other way as well, to generate one into Facebook space, by > setting > > > > canvas to > > > > > > true. > > > > > > > > > > > > > > > > > > On 3/10/08, Jonathan Otto <jonathan.otto at gmail.com> wrote: > > > > > > > was not using canvs false. i am on 2.0.2 > > > > > > > > > > > > > > > > > > > > > On Mon, Mar 10, 2008 at 1:50 PM, Christopher Bailey > > > > > > > <chris at cobaltedge.com> wrote: > > > > > > > > Yes, see my prior thread about it. What version of Rails > are > > you > > > > using? > > > > > > > > I''m having this issue with Rails 1.2.x, whereas Mike has > said he > > > > doesn''t > > > > > > > > have the problem in Rails 2.x. I assume you are putting > > > > > > ":canvas=>false" as > > > > > > > > a parameter when generating the URL? > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On 3/10/08, Jonathan Otto <jonathan.otto at gmail.com> wrote: > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > The URLs for CSS/JS files are being rewritten to the > address > > > > specified > > > > > > > > > in the tunnel even when outside of the facebook canvas. Is > > anyone > > > > else > > > > > > > > > having this problem? > > > > > > > > > _______________________________________________ > > > > > > > > > Facebooker-talk mailing list > > > > > > > > > Facebooker-talk at rubyforge.org > > > > > > > > > http://rubyforge.org/mailman/listinfo/facebooker-talk > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > > > > Christopher Bailey > > > > > > > > Cobalt Edge LLC > > > > > > > > http://cobaltedge.com > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > > > > > > > > Christopher Bailey > > > > > > Cobalt Edge LLC > > > > > > http://cobaltedge.com > > > > > > > > > > > > > > > > > > > > > -- > > > > Christopher Bailey > > > > Cobalt Edge LLC > > > > http://cobaltedge.com > > > > > > > > > > > -- > > Christopher Bailey > > Cobalt Edge LLC > > http://cobaltedge.com >-- Christopher Bailey Cobalt Edge LLC http://cobaltedge.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/facebooker-talk/attachments/20080310/b646eeac/attachment.html
Jonathan Otto
2008-Mar-10 21:46 UTC
[Facebooker-talk] facebooker is rewriting URLs even off of facebook canvas
I am doing the latter - using format to control output, but I think we may be talking about different things. The URL rewriting on routes actually does work. What doesn''t work is the Rails Root url generation. Even when outside of the canvas (and even when the tunnel is off), it is using the rails root URL from the tunnel. For example: When in Facebook, I want my stylesheet and javascript urls to be: example.com:8888/style.css (which obviously works) When not in Facebook, I want my stylesheet and javascript urls to be: example.com/style.css, or when localhosting, localhost:3000/style.css Currently, it is just using the tunnel address all the time - example.com:8000/style.css On Mon, Mar 10, 2008 at 4:02 PM, Christopher Bailey <chris at cobaltedge.com> wrote:> I''m not sure I understand the distinction. The app I''m working on is > different, in that I have a single controller that handles all our needs for > Facebook (our Facebook app is not big), and then many many other controllers > that handle our regular web app - all in the same code base. If your app > only differs by the views it renders, then that''s even tighter, and you > likely are controlling your output by format or similar. In that case it''s > technically even harder to discern where a URL goes, because you''ve got the > same controlling pulling double duty. > > > Basically, IMHO, what it comes down to, is what is your way of > distinguishing where a URL is destined for. If you know all URL''s for > certain controller(s) go to FB, then you could do a solution based on that. > If you mix and match, then you have to find another criteria. The canvas > option, when generating URL''s provides a generalized solution for all this, > and handles the edge cases, where you want to generate a URL that goes is > not for the context you are in (e.g. you want a URL that goes to your > external web app, yet the current request is within your Facebook app, or > vice versa). You shouldn''t have to use it that often, so it seems like a > fairly easy solution, and low impact. > > > > On 3/10/08, Jonathan Otto <jonathan.otto at gmail.com> wrote: > > Agreed. Still, there are situations where I want the apps to be > > separate - but from the same code (with the exception of the views). > > > > On Mon, Mar 10, 2008 at 3:11 PM, Christopher Bailey > > > > <chris at cobaltedge.com> wrote: > > > That won''t cover all your needs. Here''s an example: say you have a set > of > > > navigation links or tabs across the top of your Facebook app. One of > those > > > might actually be a link to your external site. Yet, at the time those > > > links are generated, you are in the context of Facebook, so now your > link > > > will not be correctly pointed to your external site. > > > > > > > > > Our app is primarily its own web app, but we have (well, it''ll be public > > > soon, but not yet :) a Facebook app that is mixed in to our main app, > and > > > both the web app and the Facebook app have links back and forth to each > > > other. So, in both cases, I need to be able to say, during a single > > > request, this link is for Facebook, and this other link is not, etc. > > > > > > > > > > > > On 3/10/08, Jonathan Otto <jonathan.otto at gmail.com> wrote: > > > > Shouldn''t be as simple as testing for one of the usual POST params > > > > that comes from Facebook? > > > > > > > > On Mon, Mar 10, 2008 at 2:59 PM, Christopher Bailey > > > > > > > > <chris at cobaltedge.com> wrote: > > > > > It can''t - it has no way of knowing whether the URL should be for > within > > > > > Facebook or outside. Many folks have controllers and actions that > work > > > in > > > > > both, and it just depends on the format, or various other things. > > > > > > > > > > > > > > > It might be nice to have a mechanism to say: only routes for this > > > controller > > > > > are within Facebook, assume everything else is outside, as say a > > > > > configuration option or some such, but that is not consistent across > > > > > people''s app''s. It would work for my app, and I''ve considered doing > > > that > > > > > exact kind of modification for our code, but haven''t gotten around > to it > > > > > yet. If I do, I''ll post my solution. > > > > > > > > > > > > > > > > > > > > On 3/10/08, Jonathan Otto <jonathan.otto at gmail.com> wrote: > > > > > > Yeah, that seems kind of excessive no? I''m reading through all of > the > > > > > > old discussion, trying to figure out why the > facebook_url_rewriting.rb > > > > > > file is not working correctly. When not in the canvas it should > > > > > > automatically use the normal rails routes. > > > > > > > > > > > > On Mon, Mar 10, 2008 at 2:15 PM, Christopher Bailey > > > > > > > > > > > > <chris at cobaltedge.com> wrote: > > > > > > > Ya, so, say you are doing url_for or link_to, or any named > route, > > > you > > > > > want > > > > > > > to add ":canvas => false" to the list of options when generating > the > > > > > URL. > > > > > > > That will tell it to make the URL point to your external site. > It > > > works > > > > > the > > > > > > > other way as well, to generate one into Facebook space, by > setting > > > > > canvas to > > > > > > > true. > > > > > > > > > > > > > > > > > > > > > On 3/10/08, Jonathan Otto <jonathan.otto at gmail.com> wrote: > > > > > > > > was not using canvs false. i am on 2.0.2 > > > > > > > > > > > > > > > > > > > > > > > > On Mon, Mar 10, 2008 at 1:50 PM, Christopher Bailey > > > > > > > > <chris at cobaltedge.com> wrote: > > > > > > > > > Yes, see my prior thread about it. What version of Rails > are > > > you > > > > > using? > > > > > > > > > I''m having this issue with Rails 1.2.x, whereas Mike has > said he > > > > > doesn''t > > > > > > > > > have the problem in Rails 2.x. I assume you are putting > > > > > > > ":canvas=>false" as > > > > > > > > > a parameter when generating the URL? > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On 3/10/08, Jonathan Otto <jonathan.otto at gmail.com> wrote: > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > The URLs for CSS/JS files are being rewritten to the > address > > > > > specified > > > > > > > > > > in the tunnel even when outside of the facebook canvas. Is > > > anyone > > > > > else > > > > > > > > > > having this problem? > > > > > > > > > > _______________________________________________ > > > > > > > > > > Facebooker-talk mailing list > > > > > > > > > > Facebooker-talk at rubyforge.org > > > > > > > > > > http://rubyforge.org/mailman/listinfo/facebooker-talk > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > > > > > Christopher Bailey > > > > > > > > > Cobalt Edge LLC > > > > > > > > > http://cobaltedge.com > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > > > > > > > > > > Christopher Bailey > > > > > > > Cobalt Edge LLC > > > > > > > http://cobaltedge.com > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > Christopher Bailey > > > > > Cobalt Edge LLC > > > > > http://cobaltedge.com > > > > > > > > > > > > > > > > -- > > > Christopher Bailey > > > Cobalt Edge LLC > > > http://cobaltedge.com > > > > > > -- > Christopher Bailey > Cobalt Edge LLC > http://cobaltedge.com
Christopher Bailey
2008-Mar-10 21:59 UTC
[Facebooker-talk] facebooker is rewriting URLs even off of facebook canvas
Oh, ya, ok. Have you set the Asset host? In environment.rb: ActionController::Base.asset_host = "http://www.example.com" On 3/10/08, Jonathan Otto <jonathan.otto at gmail.com> wrote:> > I am doing the latter - using format to control output, but I think we > may be talking about different things. > > The URL rewriting on routes actually does work. What doesn''t work is > the Rails Root url generation. Even when outside of the canvas (and > even when the tunnel is off), it is using the rails root URL from the > tunnel. For example: > > When in Facebook, I want my stylesheet and javascript urls to be: > example.com:8888/style.css (which obviously works) > > When not in Facebook, I want my stylesheet and javascript urls to be: > example.com/style.css, or when localhosting, localhost:3000/style.css > > Currently, it is just using the tunnel address all the time - > example.com:8000/style.css > > On Mon, Mar 10, 2008 at 4:02 PM, Christopher Bailey > > <chris at cobaltedge.com> wrote: > > I''m not sure I understand the distinction. The app I''m working on is > > different, in that I have a single controller that handles all our needs > for > > Facebook (our Facebook app is not big), and then many many other > controllers > > that handle our regular web app - all in the same code base. If your > app > > only differs by the views it renders, then that''s even tighter, and you > > likely are controlling your output by format or similar. In that case > it''s > > technically even harder to discern where a URL goes, because you''ve got > the > > same controlling pulling double duty. > > > > > > Basically, IMHO, what it comes down to, is what is your way of > > distinguishing where a URL is destined for. If you know all URL''s for > > certain controller(s) go to FB, then you could do a solution based on > that. > > If you mix and match, then you have to find another criteria. The > canvas > > option, when generating URL''s provides a generalized solution for all > this, > > and handles the edge cases, where you want to generate a URL that goes > is > > not for the context you are in (e.g. you want a URL that goes to your > > external web app, yet the current request is within your Facebook app, > or > > vice versa). You shouldn''t have to use it that often, so it seems like > a > > fairly easy solution, and low impact. > > > > > > > > On 3/10/08, Jonathan Otto <jonathan.otto at gmail.com> wrote: > > > Agreed. Still, there are situations where I want the apps to be > > > separate - but from the same code (with the exception of the views). > > > > > > On Mon, Mar 10, 2008 at 3:11 PM, Christopher Bailey > > > > > > <chris at cobaltedge.com> wrote: > > > > That won''t cover all your needs. Here''s an example: say you have a > set > > of > > > > navigation links or tabs across the top of your Facebook app. One > of > > those > > > > might actually be a link to your external site. Yet, at the time > those > > > > links are generated, you are in the context of Facebook, so now your > > link > > > > will not be correctly pointed to your external site. > > > > > > > > > > > > Our app is primarily its own web app, but we have (well, it''ll be > public > > > > soon, but not yet :) a Facebook app that is mixed in to our main > app, > > and > > > > both the web app and the Facebook app have links back and forth to > each > > > > other. So, in both cases, I need to be able to say, during a single > > > > request, this link is for Facebook, and this other link is not, etc. > > > > > > > > > > > > > > > > On 3/10/08, Jonathan Otto <jonathan.otto at gmail.com> wrote: > > > > > Shouldn''t be as simple as testing for one of the usual POST params > > > > > that comes from Facebook? > > > > > > > > > > On Mon, Mar 10, 2008 at 2:59 PM, Christopher Bailey > > > > > > > > > > <chris at cobaltedge.com> wrote: > > > > > > It can''t - it has no way of knowing whether the URL should be > for > > within > > > > > > Facebook or outside. Many folks have controllers and actions > that > > work > > > > in > > > > > > both, and it just depends on the format, or various other > things. > > > > > > > > > > > > > > > > > > It might be nice to have a mechanism to say: only routes for > this > > > > controller > > > > > > are within Facebook, assume everything else is outside, as say a > > > > > > configuration option or some such, but that is not consistent > across > > > > > > people''s app''s. It would work for my app, and I''ve considered > doing > > > > that > > > > > > exact kind of modification for our code, but haven''t gotten > around > > to it > > > > > > yet. If I do, I''ll post my solution. > > > > > > > > > > > > > > > > > > > > > > > > On 3/10/08, Jonathan Otto <jonathan.otto at gmail.com> wrote: > > > > > > > Yeah, that seems kind of excessive no? I''m reading through all > of > > the > > > > > > > old discussion, trying to figure out why the > > facebook_url_rewriting.rb > > > > > > > file is not working correctly. When not in the canvas it > should > > > > > > > automatically use the normal rails routes. > > > > > > > > > > > > > > On Mon, Mar 10, 2008 at 2:15 PM, Christopher Bailey > > > > > > > > > > > > > > <chris at cobaltedge.com> wrote: > > > > > > > > Ya, so, say you are doing url_for or link_to, or any named > > route, > > > > you > > > > > > want > > > > > > > > to add ":canvas => false" to the list of options when > generating > > the > > > > > > URL. > > > > > > > > That will tell it to make the URL point to your external > site. > > It > > > > works > > > > > > the > > > > > > > > other way as well, to generate one into Facebook space, by > > setting > > > > > > canvas to > > > > > > > > true. > > > > > > > > > > > > > > > > > > > > > > > > On 3/10/08, Jonathan Otto <jonathan.otto at gmail.com> wrote: > > > > > > > > > was not using canvs false. i am on 2.0.2 > > > > > > > > > > > > > > > > > > > > > > > > > > > On Mon, Mar 10, 2008 at 1:50 PM, Christopher Bailey > > > > > > > > > <chris at cobaltedge.com> wrote: > > > > > > > > > > Yes, see my prior thread about it. What version of > Rails > > are > > > > you > > > > > > using? > > > > > > > > > > I''m having this issue with Rails 1.2.x, whereas Mike has > > said he > > > > > > doesn''t > > > > > > > > > > have the problem in Rails 2.x. I assume you are putting > > > > > > > > ":canvas=>false" as > > > > > > > > > > a parameter when generating the URL? > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On 3/10/08, Jonathan Otto <jonathan.otto at gmail.com> > wrote: > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > The URLs for CSS/JS files are being rewritten to the > > address > > > > > > specified > > > > > > > > > > > in the tunnel even when outside of the facebook > canvas. Is > > > > anyone > > > > > > else > > > > > > > > > > > having this problem? > > > > > > > > > > > _______________________________________________ > > > > > > > > > > > Facebooker-talk mailing list > > > > > > > > > > > Facebooker-talk at rubyforge.org > > > > > > > > > > > http://rubyforge.org/mailman/listinfo/facebooker-talk > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > > > > > > Christopher Bailey > > > > > > > > > > Cobalt Edge LLC > > > > > > > > > > http://cobaltedge.com > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > > > > > > > > > > > > Christopher Bailey > > > > > > > > Cobalt Edge LLC > > > > > > > > http://cobaltedge.com > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > > Christopher Bailey > > > > > > Cobalt Edge LLC > > > > > > http://cobaltedge.com > > > > > > > > > > > > > > > > > > > > > -- > > > > Christopher Bailey > > > > Cobalt Edge LLC > > > > http://cobaltedge.com > > > > > > > > > > > -- > > Christopher Bailey > > Cobalt Edge LLC > > http://cobaltedge.com >-- Christopher Bailey Cobalt Edge LLC http://cobaltedge.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/facebooker-talk/attachments/20080310/047a5c36/attachment.html
Mike Mangino
2008-Mar-10 22:32 UTC
[Facebooker-talk] facebooker is rewriting URLs even off of facebook canvas
On Mar 10, 2008, at 4:46 PM, Jonathan Otto wrote:> I am doing the latter - using format to control output, but I think we > may be talking about different things. > > The URL rewriting on routes actually does work. What doesn''t work is > the Rails Root url generation. Even when outside of the canvas (and > even when the tunnel is off), it is using the rails root URL from the > tunnel. For example: > > When in Facebook, I want my stylesheet and javascript urls to be: > example.com:8888/style.css (which obviously works) > > When not in Facebook, I want my stylesheet and javascript urls to be: > example.com/style.css, or when localhosting, localhost:3000/style.css > > Currently, it is just using the tunnel address all the time - > example.com:8000/style.cssWhy does this matter? Both need to resolve to the same place. By default, Facebooker sets the ActionController::Base.asset_host to point to your server so that assets are served from the right location. What URL gets used doesn''t really matter, as long as it resolves an can be contacted. If you have a preference, change your asset_host. If you have a need for them to vary, you''re going to need to hack something to change the asset_host on a request by request basis. You''ll have the same problem if you allow multiple domain names and use the asset host. Mike -- Mike Mangino http://www.elevatedrails.com
Jonathan Otto
2008-Mar-10 22:49 UTC
[Facebooker-talk] facebooker is rewriting URLs even off of facebook canvas
Mike, you''re right, it shouldn''t and doesn''t matter - unless you are in development mode. I''m developing a Facebook app and a standalone app at the same time. I don''t want the tunnel URL being used when I am testing the standalone app at localhost:3000. Here is one way to get around this problem: In application.rb, I have: before_filter :from_facebook? def from_facebook? if !params[:fb_sig].nil? ActionController::Base.asset_host YAML.load_file("#{RAILS_ROOT}/config/facebooker.yml")[RAILS_ENV][''callback_url''] ensure_application_is_installed_by_facebook_user else ActionController::Base.asset_host = nil end end So you see it sets the asset_host to nil (which will make it relative) unless the user is in the Facebook canvas - which will then set it to the callback URL. Remember, the callback URL is necessary during development of Facebook applications, but is not necessary for non-Facebook applications. SO I''m trying to avoid my application referencing the Facebook callback URL when in development mode and not in the Facebook canvas. On Mon, Mar 10, 2008 at 5:32 PM, Mike Mangino <mmangino at elevatedrails.com> wrote:> > On Mar 10, 2008, at 4:46 PM, Jonathan Otto wrote: > > > I am doing the latter - using format to control output, but I think we > > may be talking about different things. > > > > The URL rewriting on routes actually does work. What doesn''t work is > > the Rails Root url generation. Even when outside of the canvas (and > > even when the tunnel is off), it is using the rails root URL from the > > tunnel. For example: > > > > When in Facebook, I want my stylesheet and javascript urls to be: > > example.com:8888/style.css (which obviously works) > > > > When not in Facebook, I want my stylesheet and javascript urls to be: > > example.com/style.css, or when localhosting, localhost:3000/style.css > > > > Currently, it is just using the tunnel address all the time - > > example.com:8000/style.css > > > > Why does this matter? Both need to resolve to the same place. > > By default, Facebooker sets the ActionController::Base.asset_host to > point to your server so that assets are served from the right > location. What URL gets used doesn''t really matter, as long as it > resolves an can be contacted. If you have a preference, change your > asset_host. If you have a need for them to vary, you''re going to need > to hack something to change the asset_host on a request by request > basis. You''ll have the same problem if you allow multiple domain names > and use the asset host. > > Mike > > > -- > Mike Mangino > http://www.elevatedrails.com > > > >
Christopher Bailey
2008-Mar-10 23:06 UTC
[Facebooker-talk] facebooker is rewriting URLs even off of facebook canvas
The other approach is setting your asset host based on your Rails environment. That''s what I do. This is also handy if you have a continuous integration server, a staging server, and so on. For dev I set it locally, but then we have a staging/test server, and that is different than locally, and also not our main domain name, so I need to set it for that, etc. The asset host is probably something that deserves a bit of doc, mostly to point out the caveats of it''s use, in particular as pertains to development vs. production (or staging/test, etc.). But uh, I guess this thread would be the doc ;-) On 3/10/08, Jonathan Otto <jonathan.otto at gmail.com> wrote:> > Mike, you''re right, it shouldn''t and doesn''t matter - unless you are > in development mode. I''m developing a Facebook app and a standalone > app at the same time. I don''t want the tunnel URL being used when I am > testing the standalone app at localhost:3000. > > Here is one way to get around this problem: > > In application.rb, I have: > > before_filter :from_facebook? > > def from_facebook? > if !params[:fb_sig].nil? > ActionController::Base.asset_host > YAML.load_file > ("#{RAILS_ROOT}/config/facebooker.yml")[RAILS_ENV][''callback_url''] > ensure_application_is_installed_by_facebook_user > else > ActionController::Base.asset_host = nil > end > end > > So you see it sets the asset_host to nil (which will make it relative) > unless the user is in the Facebook canvas - which will then set it to > the callback URL. > > Remember, the callback URL is necessary during development of Facebook > applications, but is not necessary for non-Facebook applications. SO > I''m trying to avoid my application referencing the Facebook callback > URL when in development mode and not in the Facebook canvas. > > > On Mon, Mar 10, 2008 at 5:32 PM, Mike Mangino > <mmangino at elevatedrails.com> wrote: > > > > On Mar 10, 2008, at 4:46 PM, Jonathan Otto wrote: > > > > > I am doing the latter - using format to control output, but I think > we > > > may be talking about different things. > > > > > > The URL rewriting on routes actually does work. What doesn''t work is > > > the Rails Root url generation. Even when outside of the canvas (and > > > even when the tunnel is off), it is using the rails root URL from the > > > tunnel. For example: > > > > > > When in Facebook, I want my stylesheet and javascript urls to be: > > > example.com:8888/style.css (which obviously works) > > > > > > When not in Facebook, I want my stylesheet and javascript urls to be: > > > example.com/style.css, or when localhosting, localhost:3000/style.css > > > > > > Currently, it is just using the tunnel address all the time - > > > example.com:8000/style.css > > > > > > > > Why does this matter? Both need to resolve to the same place. > > > > By default, Facebooker sets the ActionController::Base.asset_host to > > point to your server so that assets are served from the right > > location. What URL gets used doesn''t really matter, as long as it > > resolves an can be contacted. If you have a preference, change your > > asset_host. If you have a need for them to vary, you''re going to need > > to hack something to change the asset_host on a request by request > > basis. You''ll have the same problem if you allow multiple domain names > > and use the asset host. > > > > Mike > > > > > > -- > > Mike Mangino > > http://www.elevatedrails.com > > > > > > > > >-- Christopher Bailey Cobalt Edge LLC http://cobaltedge.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/facebooker-talk/attachments/20080310/fb71e314/attachment.html
Jonathan Otto
2008-Mar-16 23:25 UTC
[Facebooker-talk] facebooker is rewriting URLs even off of facebook canvas
What about CSS files? Facebook requires any URLs in a CSS to be absolute (background image for example). Any preferred way to execute code in a CSS file in Rails? On Mon, Mar 10, 2008 at 6:06 PM, Christopher Bailey <chris at cobaltedge.com> wrote:> The other approach is setting your asset host based on your Rails > environment. That''s what I do. This is also handy if you have a continuous > integration server, a staging server, and so on. For dev I set it locally, > but then we have a staging/test server, and that is different than locally, > and also not our main domain name, so I need to set it for that, etc. > > > The asset host is probably something that deserves a bit of doc, mostly to > point out the caveats of it''s use, in particular as pertains to development > vs. production (or staging/test, etc.). But uh, I guess this thread would > be the doc ;-) > > > On 3/10/08, Jonathan Otto <jonathan.otto at gmail.com> wrote: > > > Mike, you''re right, it shouldn''t and doesn''t matter - unless you are > > in development mode. I''m developing a Facebook app and a standalone > > app at the same time. I don''t want the tunnel URL being used when I am > > testing the standalone app at localhost:3000. > > > > Here is one way to get around this problem: > > > > In application.rb, I have: > > > > before_filter :from_facebook? > > > > def from_facebook? > > if !params[:fb_sig].nil? > > ActionController::Base.asset_host > > > YAML.load_file("#{RAILS_ROOT}/config/facebooker.yml")[RAILS_ENV][''callback_url''] > > ensure_application_is_installed_by_facebook_user > > else > > ActionController::Base.asset_host = nil > > end > > end > > > > So you see it sets the asset_host to nil (which will make it relative) > > unless the user is in the Facebook canvas - which will then set it to > > the callback URL. > > > > Remember, the callback URL is necessary during development of Facebook > > applications, but is not necessary for non-Facebook applications. SO > > I''m trying to avoid my application referencing the Facebook callback > > URL when in development mode and not in the Facebook canvas. > > > > > > On Mon, Mar 10, 2008 at 5:32 PM, Mike Mangino > > <mmangino at elevatedrails.com> wrote: > > > > > > On Mar 10, 2008, at 4:46 PM, Jonathan Otto wrote: > > > > > > > I am doing the latter - using format to control output, but I think > we > > > > may be talking about different things. > > > > > > > > The URL rewriting on routes actually does work. What doesn''t work is > > > > the Rails Root url generation. Even when outside of the canvas (and > > > > even when the tunnel is off), it is using the rails root URL from the > > > > tunnel. For example: > > > > > > > > When in Facebook, I want my stylesheet and javascript urls to be: > > > > example.com:8888/style.css (which obviously works) > > > > > > > > When not in Facebook, I want my stylesheet and javascript urls to be: > > > > example.com/style.css, or when localhosting, localhost:3000/style.css > > > > > > > > Currently, it is just using the tunnel address all the time - > > > > example.com:8000/style.css > > > > > > > > > > > > Why does this matter? Both need to resolve to the same place. > > > > > > By default, Facebooker sets the ActionController::Base.asset_host to > > > point to your server so that assets are served from the right > > > location. What URL gets used doesn''t really matter, as long as it > > > resolves an can be contacted. If you have a preference, change your > > > asset_host. If you have a need for them to vary, you''re going to need > > > to hack something to change the asset_host on a request by request > > > basis. You''ll have the same problem if you allow multiple domain names > > > and use the asset host. > > > > > > Mike > > > > > > > > > -- > > > Mike Mangino > > > http://www.elevatedrails.com > > > > > > > > > > > > > > > > > > -- > Christopher Bailey > Cobalt Edge LLC > http://cobaltedge.com
Mike Mangino
2008-Mar-17 00:16 UTC
[Facebooker-talk] facebooker is rewriting URLs even off of facebook canvas
I put css that involves images in a _css partial that gets rendered into my layouts. I use external css for the rest. You''ll probably also want to store profile CSS in a partial, as profiles don''t read external stylesheets. Mike On Mar 16, 2008, at 6:25 PM, Jonathan Otto wrote:> What about CSS files? Facebook requires any URLs in a CSS to be > absolute (background image for example). Any preferred way to execute > code in a CSS file in Rails? > > On Mon, Mar 10, 2008 at 6:06 PM, Christopher Bailey > <chris at cobaltedge.com> wrote: >> The other approach is setting your asset host based on your Rails >> environment. That''s what I do. This is also handy if you have a >> continuous >> integration server, a staging server, and so on. For dev I set it >> locally, >> but then we have a staging/test server, and that is different than >> locally, >> and also not our main domain name, so I need to set it for that, etc. >> >> >> The asset host is probably something that deserves a bit of doc, >> mostly to >> point out the caveats of it''s use, in particular as pertains to >> development >> vs. production (or staging/test, etc.). But uh, I guess this >> thread would >> be the doc ;-) >> >> >> On 3/10/08, Jonathan Otto <jonathan.otto at gmail.com> wrote: >> >>> Mike, you''re right, it shouldn''t and doesn''t matter - unless you are >>> in development mode. I''m developing a Facebook app and a standalone >>> app at the same time. I don''t want the tunnel URL being used when >>> I am >>> testing the standalone app at localhost:3000. >>> >>> Here is one way to get around this problem: >>> >>> In application.rb, I have: >>> >>> before_filter :from_facebook? >>> >>> def from_facebook? >>> if !params[:fb_sig].nil? >>> ActionController::Base.asset_host >>> >> YAML.load_file("#{RAILS_ROOT}/config/facebooker.yml")[RAILS_ENV] >> [''callback_url''] >>> ensure_application_is_installed_by_facebook_user >>> else >>> ActionController::Base.asset_host = nil >>> end >>> end >>> >>> So you see it sets the asset_host to nil (which will make it >>> relative) >>> unless the user is in the Facebook canvas - which will then set it >>> to >>> the callback URL. >>> >>> Remember, the callback URL is necessary during development of >>> Facebook >>> applications, but is not necessary for non-Facebook applications. SO >>> I''m trying to avoid my application referencing the Facebook callback >>> URL when in development mode and not in the Facebook canvas. >>> >>> >>> On Mon, Mar 10, 2008 at 5:32 PM, Mike Mangino >>> <mmangino at elevatedrails.com> wrote: >>>> >>>> On Mar 10, 2008, at 4:46 PM, Jonathan Otto wrote: >>>> >>>>> I am doing the latter - using format to control output, but I >>>>> think >> we >>>>> may be talking about different things. >>>>> >>>>> The URL rewriting on routes actually does work. What doesn''t >>>>> work is >>>>> the Rails Root url generation. Even when outside of the canvas >>>>> (and >>>>> even when the tunnel is off), it is using the rails root URL >>>>> from the >>>>> tunnel. For example: >>>>> >>>>> When in Facebook, I want my stylesheet and javascript urls to be: >>>>> example.com:8888/style.css (which obviously works) >>>>> >>>>> When not in Facebook, I want my stylesheet and javascript urls >>>>> to be: >>>>> example.com/style.css, or when localhosting, localhost:3000/ >>>>> style.css >>>>> >>>>> Currently, it is just using the tunnel address all the time - >>>>> example.com:8000/style.css >>>> >>>> >>>> >>>> Why does this matter? Both need to resolve to the same place. >>>> >>>> By default, Facebooker sets the ActionController::Base.asset_host >>>> to >>>> point to your server so that assets are served from the right >>>> location. What URL gets used doesn''t really matter, as long as it >>>> resolves an can be contacted. If you have a preference, change your >>>> asset_host. If you have a need for them to vary, you''re going to >>>> need >>>> to hack something to change the asset_host on a request by request >>>> basis. You''ll have the same problem if you allow multiple domain >>>> names >>>> and use the asset host. >>>> >>>> Mike >>>> >>>> >>>> -- >>>> Mike Mangino >>>> http://www.elevatedrails.com >>>> >>>> >>>> >>>> >>> >> >> >> >> -- >> Christopher Bailey >> Cobalt Edge LLC >> http://cobaltedge.com-- Mike Mangino http://www.elevatedrails.com