From sbwoodside at yahoo.com Sun Mar 2 01:50:10 2008 From: sbwoodside at yahoo.com (S. Woodside) Date: Sun, 2 Mar 2008 01:50:10 -0500 Subject: [Facebooker-talk] multiple controllers Message-ID: <5478C61F-7155-45E8-BA40-45FFFE1B0A16@yahoo.com> Hi bit of a newbie question here. What is the "right" way to do have multiple controllers in my facebooker app. Should I create a "namespace" for my models? e.g. controllers/facebook/index.fbml.erb would become controllers/facebook/ section1/index.fbml.erb etc. If I do that, what other changes do I need to make, e.g. to my routes? And then, let's say I'm doing an fb:action or a link_to, what changes do I need to make there? --simon -- http://simonwoodside.com From mniessner at elevatedrails.com Sun Mar 2 02:08:43 2008 From: mniessner at elevatedrails.com (Michael Niessner) Date: Sun, 2 Mar 2008 01:08:43 -0600 Subject: [Facebooker-talk] multiple controllers In-Reply-To: <5478C61F-7155-45E8-BA40-45FFFE1B0A16@yahoo.com> References: <5478C61F-7155-45E8-BA40-45FFFE1B0A16@yahoo.com> Message-ID: It depends. I typically just have controllers/some_controller.rb controllers/some_other_controller.rb. Some people desire to sandbox facebook functionality to a specific portion of their site. In that case you would probably want to use a namespace for your controllers. Your routes without namespaces would look like: map.resources :some_controller map.resources :some_other_controller Your routes with namespaces would look like: map.namespace(:your_namespace) do |your_namespace| your_namespace.resources :some_controller your_namespace.resources :some_other_controller end I haven't had a need to create a namespace for any of my models. Michael Niessner On Mar 2, 2008, at 12:50 AM, S. Woodside wrote: > Hi bit of a newbie question here. > > What is the "right" way to do have multiple controllers in my > facebooker app. Should I create a "namespace" for my models? e.g. > controllers/facebook/index.fbml.erb would become controllers/facebook/ > section1/index.fbml.erb etc. > > If I do that, what other changes do I need to make, e.g. to my routes? > > And then, let's say I'm doing an fb:action or a link_to, what changes > do I need to make there? > > --simon > > -- > http://simonwoodside.com > > _______________________________________________ > Facebooker-talk mailing list > Facebooker-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/facebooker-talk From sbwoodside at yahoo.com Sun Mar 2 02:25:22 2008 From: sbwoodside at yahoo.com (S. Woodside) Date: Sun, 2 Mar 2008 02:25:22 -0500 Subject: [Facebooker-talk] RESTful Delete Message-ID: Facebook seems to always use POST for canvas page calls, but I did see this: http://www.henriquez.net/2007/09/so-you-start-new-ruby-on-rails.html --simon > Does it work if you change it to a form with a button and use :html => > { :method => :delete } ? > > Shane > > On Thu, Feb 14, 2008 at 2:09 PM, Brian Howenstein hwrd.com> wrote: > > I sent this question out about a week ago, but never got a > response... > > > > I have so far been unable to do a RESTful delete using Facebooker. > > > > In my config/routes.rb, I have: > > > > map.resources :runs > > > > I am trying to do the delete using: > > > > <%= link_to "Delete", run, :method => :delete %> > > > > However, instead of doing the 'delete', it calls the 'show' action. > > > > Has anyone been successful doing a RESTful delete using Facebooker? > > > > Thanks, > > Brian -- http://simonwoodside.com From sbwoodside at yahoo.com Sun Mar 2 17:38:16 2008 From: sbwoodside at yahoo.com (S. Woodside) Date: Sun, 2 Mar 2008 17:38:16 -0500 Subject: [Facebooker-talk] belongs_to and facebooker Message-ID: <19587EDA-7289-4A1B-889B-539EEA179CF8@yahoo.com> It would be cool if I could use belongs_to to link my own models to facebook's models (e.g. if I could have a table "cool_people" belongs_to a facebook group/gid). Generally speaking it would be nice if facebooker's models worked more like traditional ActiveRecord objects, for example event.members instead of calling session.event_members(eid). --simon -- http://simonwoodside.com From mmangino at elevatedrails.com Sun Mar 2 18:09:52 2008 From: mmangino at elevatedrails.com (Mike Mangino) Date: Sun, 2 Mar 2008 17:09:52 -0600 Subject: [Facebooker-talk] belongs_to and facebooker In-Reply-To: <19587EDA-7289-4A1B-889B-539EEA179CF8@yahoo.com> References: <19587EDA-7289-4A1B-889B-539EEA179CF8@yahoo.com> Message-ID: Some of the objects already work this way. For instance, there is an albums method on User which deals with loading the right albums. Unfortunately, Facebook's terms of service prohibit storing most of the API information, so storing information in a table isn't allowed. Mike On Mar 2, 2008, at 4:38 PM, S. Woodside wrote: > It would be cool if I could use belongs_to to link my own models to > facebook's models (e.g. if I could have a table "cool_people" > belongs_to a facebook group/gid). Generally speaking it would be nice > if facebooker's models worked more like traditional ActiveRecord > objects, for example event.members instead of calling > session.event_members(eid). > > --simon > > -- > http://simonwoodside.com > > _______________________________________________ > Facebooker-talk mailing list > Facebooker-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/facebooker-talk -- Mike Mangino http://www.elevatedrails.com From sbwoodside at yahoo.com Sun Mar 2 22:01:04 2008 From: sbwoodside at yahoo.com (S. Woodside) Date: Sun, 2 Mar 2008 22:01:04 -0500 Subject: [Facebooker-talk] belongs_to and facebooker In-Reply-To: References: <19587EDA-7289-4A1B-889B-539EEA179CF8@yahoo.com> Message-ID: I realize it's still early days! I'm thinking about a direction I think it would be good to go in in general with Facebooker. So right now I might do something like this: @event = @fb_sess.events( :eid => my_id ).first # Array of Attendance: @invited_users = @ fb_sess.event_members( @event.eid ) <%= fb_name @invited_users.first.uid %> Whereas a more "rails" way to do it would be: # Automatically accesses my session in a class method: @event = Facebooker::Event( :eid => my_id ).first # here Event has_many members (Users): @invited_users = @event.members # fb_name understands User object: <%= fb_name @invited_users.first %> It's farther away from the facebook PHP model but more railsy and I think easier to code with. --simon PS For storing local information, I don't get why that matters here, you can cache for up to 24 hours and if the cache is expired, just transparently reload the data from facebook. PPS I guess that I'm not talking about actually mirroring FB's data here into local models, but "faking it out" somehow to make it seem like its more active recordsy -- http://simonwoodside.com On Mar 2, 2008, at 6:09 PM, Mike Mangino wrote: > Some of the objects already work this way. For instance, there is > an albums method on User which deals with loading the right albums. > Unfortunately, Facebook's terms of service prohibit storing most of > the API information, so storing information in a table isn't allowed. > > Mike > > On Mar 2, 2008, at 4:38 PM, S. Woodside wrote: > >> It would be cool if I could use belongs_to to link my own models to >> facebook's models (e.g. if I could have a table "cool_people" >> belongs_to a facebook group/gid). Generally speaking it would be nice >> if facebooker's models worked more like traditional ActiveRecord >> objects, for example event.members instead of calling >> session.event_members(eid). >> >> --simon >> >> -- >> http://simonwoodside.com >> >> _______________________________________________ >> Facebooker-talk mailing list >> Facebooker-talk at rubyforge.org >> http://rubyforge.org/mailman/listinfo/facebooker-talk > > -- > Mike Mangino > http://www.elevatedrails.com > > From mmangino at elevatedrails.com Sun Mar 2 23:06:29 2008 From: mmangino at elevatedrails.com (Mike Mangino) Date: Sun, 2 Mar 2008 22:06:29 -0600 Subject: [Facebooker-talk] belongs_to and facebooker In-Reply-To: References: <19587EDA-7289-4A1B-889B-539EEA179CF8@yahoo.com> Message-ID: <5246B574-C217-40D2-8903-39F5F13DFA49@elevatedrails.com> We would love patches to do that. You can take a look at how user implement albums. Mike On Mar 2, 2008, at 9:01 PM, S. Woodside wrote: > I realize it's still early days! I'm thinking about a direction I > think it would be good to go in in general with Facebooker. > > So right now I might do something like this: > > @event = @fb_sess.events( :eid => my_id ).first > # Array of Attendance: > @invited_users = @ fb_sess.event_members( @event.eid ) > <%= fb_name @invited_users.first.uid %> > > Whereas a more "rails" way to do it would be: > > # Automatically accesses my session in a class method: > @event = Facebooker::Event( :eid => my_id ).first > # here Event has_many members (Users): > @invited_users = @event.members > # fb_name understands User object: > <%= fb_name @invited_users.first %> > > It's farther away from the facebook PHP model but more railsy and I > think easier to code with. > > --simon > > PS For storing local information, I don't get why that matters here, > you can cache for up to 24 hours and if the cache is expired, just > transparently reload the data from facebook. > > PPS I guess that I'm not talking about actually mirroring FB's data > here into local models, but "faking it out" somehow to make it seem > like its more active recordsy > > -- > http://simonwoodside.com > > > On Mar 2, 2008, at 6:09 PM, Mike Mangino wrote: > >> Some of the objects already work this way. For instance, there is >> an albums method on User which deals with loading the right albums. >> Unfortunately, Facebook's terms of service prohibit storing most of >> the API information, so storing information in a table isn't allowed. >> >> Mike >> >> On Mar 2, 2008, at 4:38 PM, S. Woodside wrote: >> >>> It would be cool if I could use belongs_to to link my own models to >>> facebook's models (e.g. if I could have a table "cool_people" >>> belongs_to a facebook group/gid). Generally speaking it would be >>> nice >>> if facebooker's models worked more like traditional ActiveRecord >>> objects, for example event.members instead of calling >>> session.event_members(eid). >>> >>> --simon >>> >>> -- >>> http://simonwoodside.com >>> >>> _______________________________________________ >>> 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 From jnylund at yahoo.com Mon Mar 3 19:14:08 2008 From: jnylund at yahoo.com (Joel Nylund) Date: Mon, 3 Mar 2008 19:14:08 -0500 Subject: [Facebooker-talk] I think I know why plugin installer is not getting http_multipart_post.rb Message-ID: <70D07605-73D8-43EB-A725-688B743CAB13@yahoo.com> looking through the rails source, I think it skips the download of the file if it starts with http. (links method of RecursiveHTTPFetcher which is used by plugin installer) def links(base_url, contents) links = [] contents.scan(/href\s*=\s*\"*[^\">]*/i) do |link| link = link.sub(/href="/i, "") next if link =~ /^http/i || link =~ /^\./ links << File.join(base_url, link) end links end Since the one file thats not getting downloaded is net/ http_multipart_post.rb Can one of the committers rename the file to not start with http? Once its done I can test to be sure, but im pretty sure this is the problem. It will save lots of folks headaches, I know the gem is preferred, but if there is going to be a plugin, it should work, and its been broken for a long while now. thanks Joel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/facebooker-talk/attachments/20080303/4b97966f/attachment.html From digidigo at gmail.com Mon Mar 3 19:28:50 2008 From: digidigo at gmail.com (David Clements) Date: Mon, 3 Mar 2008 17:28:50 -0700 Subject: [Facebooker-talk] I think I know why plugin installer is not getting http_multipart_post.rb In-Reply-To: <70D07605-73D8-43EB-A725-688B743CAB13@yahoo.com> References: <70D07605-73D8-43EB-A725-688B743CAB13@yahoo.com> Message-ID: Hey Joel, I am not seeing this problem. I am on rails 2.02 and just did a fresh plugin install and it came down fine. Screen cast, longer than I wanted it to be, you can skip ahead about 2/3 of the way through: http://screencast.com/t/sak9LJRUy On Mon, Mar 3, 2008 at 5:14 PM, Joel Nylund wrote: > looking through the rails source, I think it skips the download of the file > if it starts with http. > > (links method of RecursiveHTTPFetcher which is used by plugin installer) > > > def links(base_url, contents) > links = [] > contents.scan(/href\s*=\s*\"*[^\">]*/i) do |link| > link = link.sub(/href="/i, "") > next if link =~ /^http/i || link =~ /^\./ > links << File.join(base_url, link) > end > links > end > > Since the one file thats not getting downloaded is > net/http_multipart_post.rb > > Can one of the committers rename the file to not start with http? > > Once its done I can test to be sure, but im pretty sure this is the problem. > > It will save lots of folks headaches, I know the gem is preferred, but if > there is going to be a plugin, it should work, and its been broken for a > long while now. > > thanks > Joel > > > _______________________________________________ > Facebooker-talk mailing list > Facebooker-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/facebooker-talk > > From jnylund at yahoo.com Mon Mar 3 19:31:30 2008 From: jnylund at yahoo.com (Joel Nylund) Date: Mon, 3 Mar 2008 16:31:30 -0800 (PST) Subject: [Facebooker-talk] I think I know why plugin installer is not getting http_multipart_post.rb Message-ID: <900817.43879.qm@web50609.mail.re2.yahoo.com> Must be a rails 1.2.x problem Joel On Mar 3, 2008, at 7:28 PM, "David Clements" wrote: Hey Joel, I am not seeing this problem. I am on rails 2.02 and just did a fresh plugin install and it came down fine. Screen cast, longer than I wanted it to be, you can skip ahead about 2/3 of the way through: http://screencast.com/t/sak9LJRUy On Mon, Mar 3, 2008 at 5:14 PM, Joel Nylund wrote: looking through the rails source, I think it skips the download of the file if it starts with http. (links method of RecursiveHTTPFetcher which is used by plugin installer) def links(base_url, contents) links = [] contents.scan(/href\s*=\s*\"*[^\">]*/i) do |link| link = link.sub(/href="/i, "") next if link =~ /^http/i || link =~ /^\./ links << File.join(base_url, link) end links end Since the one file thats not getting downloaded is net/http_multipart_post.rb Can one of the committers rename the file to not start with http? Once its done I can test to be sure, but im pretty sure this is the problem. It will save lots of folks headaches, I know the gem is preferred, but if there is going to be a plugin, it should work, and its been broken for a long while now. thanks Joel _______________________________________________ Facebooker-talk mailing list Facebooker-talk at rubyforge.org http://rubyforge.org/mailman/listinfo/facebooker-talk From michael.tedesco at peermeta.com Mon Mar 3 19:39:30 2008 From: michael.tedesco at peermeta.com (Michael Tedesco) Date: Mon, 3 Mar 2008 19:39:30 -0500 Subject: [Facebooker-talk] Can someone tell me if this is possible Message-ID: I'd like to make a call to the following URL passing my API_KEY. Two questions http://www.facebook.com/code_gen.php/v=1.0&api_key=MY_API_KEY I'd like to access my stored api_key 1) Can I do it from the following start point t_session = Facebooker::Session.create then somehow access the key 2) I'm also trying to do the following from my Controller def temp_session t_session = Facebooker::Session.create t_session.secure_with!(self.facebook_session_key, self.facebook_uid, 0) return t_session end but I'm getting the following error undefined method `facebook_session_key' for # -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/facebooker-talk/attachments/20080303/197a1fc9/attachment.html From joel at i5labs.com Mon Mar 3 22:17:01 2008 From: joel at i5labs.com (Joel Watson) Date: Mon, 3 Mar 2008 19:17:01 -0800 Subject: [Facebooker-talk] Can someone tell me if this is possible In-Reply-To: References: Message-ID: For number one, you want to do something like this: t_session = Facebooker::Session.create(Facebooker::Session.api_key, Facebooker::Session.secret_key) Though I haven't looked into the underlying code directly, I'm guessing Facebooker::Session.api_key and secret_key are both loaded from your facebooker.yml file at load time. For number two. If that method is in your controller and facebook_session_key is an attribute of your user model, then the problem is self.facebook_session_key is attemping to call facebook_session_key on the controller, not your user object. I would move that method to your user model and then call it in your controller. class User < ActiveRecord::Base def restore_facebook_session return @facebook_session unless @facebook_session.nil? @facebook_session = Facebooker::Session.create(Facebooker::Session.api_key, Facebooker::Session.secret_key) @facebook_session.secure_with!(facebook_session_key, facebook_uid, 0) @facebook_session end end where facebook_session_key and facebook_uid are attributes of your User. class FacebookController < ApplicationController def some_action @user = User.find(params[:id]) @facebook_session = @user.restore_facebook_session # do stuff with your facebook session end end -Joel On Mar 3, 2008, at 4:39 PM, Michael Tedesco wrote: > I?d like to make a call to the following URL passing my API_KEY. > Two questions > > http://www.facebook.com/code_gen.php/v=1.0&api_key=MY_API_KEY > > I?d like to access my stored api_key > 1) Can I do it from the following start point > t_session = Facebooker::Session.create > > then somehow access the key > > 2) I?m also trying to do the following from my Controller > def temp_session > t_session = Facebooker::Session.create > t_session.secure_with!(self.facebook_session_key, > self.facebook_uid, 0) > return t_session > end > > but I?m getting the following error > undefined method `facebook_session_key' for > # > > _______________________________________________ > 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/20080303/c495491c/attachment-0001.html From michael.tedesco at peermeta.com Tue Mar 4 12:07:25 2008 From: michael.tedesco at peermeta.com (Michael Tedesco) Date: Tue, 4 Mar 2008 12:07:25 -0500 Subject: [Facebooker-talk] Can someone tell me if this is possible In-Reply-To: References: Message-ID: Thanks Joel: Does facebooker have a similar function to the following - to return facebook generated session key facebook.auth.getSession ? n Thanks, Mike From: Joel Watson [mailto:joel at i5labs.com] Sent: Monday, March 03, 2008 10:17 PM To: Michael Tedesco Cc: facebooker-talk at rubyforge.org Subject: Re: [Facebooker-talk] Can someone tell me if this is possible For number one, you want to do something like this: t_session = Facebooker::Session.create(Facebooker::Session.api_key, Facebooker::Session.secret_key) Though I haven't looked into the underlying code directly, I'm guessing Facebooker::Session.api_key and secret_key are both loaded from your facebooker.yml file at load time. For number two. If that method is in your controller and facebook_session_key is an attribute of your user model, then the problem is self.facebook_session_key is attemping to call facebook_session_key on the controller, not your user object. I would move that method to your user model and then call it in your controller. class User < ActiveRecord::Base def restore_facebook_session return @facebook_session unless @facebook_session.nil? @facebook_session = Facebooker::Session.create(Facebooker::Session.api_key, Facebooker::Session.secret_key) @facebook_session.secure_with!(facebook_session_key, facebook_uid, 0) @facebook_session end end where facebook_session_key and facebook_uid are attributes of your User. class FacebookController < ApplicationController def some_action @user = User.find(params[:id]) @facebook_session = @user.restore_facebook_session # do stuff with your facebook session end end -Joel On Mar 3, 2008, at 4:39 PM, Michael Tedesco wrote: I'd like to make a call to the following URL passing my API_KEY. Two questions http://www.facebook.com/code_gen.php/v=1.0&api_key=MY_API_KEY I'd like to access my stored api_key 1) Can I do it from the following start point t_session = Facebooker::Session.create then somehow access the key 2) I'm also trying to do the following from my Controller def temp_session t_session = Facebooker::Session.create t_session.secure_with!(self.facebook_session_key, self.facebook_uid, 0) return t_session end but I'm getting the following error undefined method `facebook_session_key' for # _______________________________________________ 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/20080304/41950d3c/attachment.html From jnylund at yahoo.com Tue Mar 4 12:42:09 2008 From: jnylund at yahoo.com (Joel Nylund) Date: Tue, 4 Mar 2008 12:42:09 -0500 Subject: [Facebooker-talk] facebook_url_rewriting.rb In-Reply-To: <4ab757a40802271940s2357d545sf1ab0fa80c470d59@mail.gmail.com> References: <43A02353-93C4-434D-AC9A-AB85ECABE669@i5labs.com> <4ab757a40802271650o30ba51d7rc13b3b4db2b189df@mail.gmail.com> <55DEA0C9-B908-4F81-B8F2-032774BA35C5@yahoo.com> <4ab757a40802271940s2357d545sf1ab0fa80c470d59@mail.gmail.com> Message-ID: <0DEC9772-165D-4B67-99B6-5C8AB727459C@yahoo.com> Hey, guys, I have been struggling to figure out a reasonable way to test this. Can someone help me with the strategy? I dont see any test cases for rewrite_url_with_facebooker today, so I don't have any guidelines to go on. What I think I need to test is a working version of url_for that allows me to set all the basics up. The integration tests seem to have url_for stubbed out. What we basically want to test is: If the user is in a canvas and if they have FACEBOOKER_SANDBOX_NAMESPACE defined, that we strip off the namespace in the urls that are generated. So in my application for example I have: FACEBOOKER_SANDBOX_NAMESPACE: /face FACEBOOKER_RELATIVE_URL_ROOT: gottakeepup path is: /gottakeepup/face/destroy_task?task_id=3935 after rewrite path is: /gottakeepup/destroy_task?task_id=3935 Works like a charm in a real application, but how can I produce this scenario in the test framework? thanks Joel On Feb 27, 2008, at 10:40 PM, Shane Vitarana wrote: > Hey the other Joel :) Yup, the var name change, and tests have to be > added that covers the change. Then submit it to Rubyforge. > > On Wed, Feb 27, 2008 at 8:15 PM, Joel Nylund > wrote: >> Ive been using Shawns patch for a while and it works great, what >> can I >> do to help Shane? Just change the var name and submit to sourceforge? >> >> thanks >> Joel Nylund (the other Joel) >> >> >> >> On Feb 27, 2008, at 7:50 PM, Shane Vitarana wrote: >> >> >> >>> Joel- >>> >>> I've been meaning to do it using Shawn's patch but didn't get around >>> to it yet. It's on my todo list, but if anyone else has a need >>> for it >>> and does it, it'll be much appreciated. >>> >>> Shane >>> >>> On Wed, Feb 27, 2008 at 6:37 PM, Joel Watson >>> wrote: >>>> Hi all! >>>> >>>> Just curious if that namespace support had been added as >>>> discussed in >>>> a previous thread using this name. I've currently got my facebook >>>> app's controllers inside a subfolder named "facebook" and my >>>> callback >>>> url looks something like "http://app-domain.com/facebook/". Routes >>>> are >>>> set up appropriately to direct facebook/:action url's to the >>>> appropriate controller. Unfortunately, my callback url is being >>>> prepended to my javascript/stylesheet includes in the main (non- >>>> facebook) part of the app giving me something like this for each >>>> stylesheet/javascript include: >>>> >>>> ActionController::RoutingError (No route matches "/facebook// >>>> stylesheets/groups.css" with {:canvas=>false, :method=>:get}) >>>> >>>> It's entirely possible that I've just horribly misconfigured >>>> something. If so, hopefully someone out there has some ideas. :-) >>>> >>>> Thanks! >>>> >>>> -Joel >>>> _______________________________________________ >>>> Facebooker-talk mailing list >>>> Facebooker-talk at rubyforge.org >>>> http://rubyforge.org/mailman/listinfo/facebooker-talk >>>> >>> >>> >>> >>> -- >>> http://shanesbrain.net | http://crimsonjet.com | http://myfitbuddy.com >>> _______________________________________________ >>> Facebooker-talk mailing list >>> Facebooker-talk at rubyforge.org >>> http://rubyforge.org/mailman/listinfo/facebooker-talk >> >> >> > > > > -- > http://shanesbrain.net | http://crimsonjet.com | http://myfitbuddy.com From chris at cobaltedge.com Tue Mar 4 14:12:51 2008 From: chris at cobaltedge.com (Christopher Bailey) Date: Tue, 4 Mar 2008 11:12:51 -0800 Subject: [Facebooker-talk] How to build URL's in models/outside controller/view code? Message-ID: <443c240c0803041112w75a47baei1cb97337f943e5e9@mail.gmail.com> I'm building FBML in an asynchronous process, which is spawned from model code. There is no associated HTTP request, and thus no controller or view facilities available. I'm wondering if others do this, and what you recommend for building URL's (e.g. with lack of link_to and url_for, etc.)? -- Christopher Bailey Cobalt Edge LLC http://cobaltedge.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/facebooker-talk/attachments/20080304/3ac00420/attachment.html From digidigo at gmail.com Tue Mar 4 14:22:29 2008 From: digidigo at gmail.com (David Clements) Date: Tue, 4 Mar 2008 12:22:29 -0700 Subject: [Facebooker-talk] How to build URL's in models/outside controller/view code? In-Reply-To: <443c240c0803041112w75a47baei1cb97337f943e5e9@mail.gmail.com> References: <443c240c0803041112w75a47baei1cb97337f943e5e9@mail.gmail.com> Message-ID: The new Publisher Api supports this have you looked at that? You have access to all the view helpers and url_for. Are you pushing profile fbml? It supports that. Dave On Tue, Mar 4, 2008 at 12:12 PM, Christopher Bailey wrote: > I'm building FBML in an asynchronous process, which is spawned from model > code. There is no associated HTTP request, and thus no controller or view > facilities available. I'm wondering if others do this, and what you > recommend for building URL's (e.g. with lack of link_to and url_for, etc.)? > > -- > Christopher Bailey > Cobalt Edge LLC > http://cobaltedge.com > _______________________________________________ > Facebooker-talk mailing list > Facebooker-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/facebooker-talk > > From mniessner at elevatedrails.com Tue Mar 4 14:43:49 2008 From: mniessner at elevatedrails.com (Michael Niessner) Date: Tue, 4 Mar 2008 13:43:49 -0600 Subject: [Facebooker-talk] How to build URL's in models/outside controller/view code? In-Reply-To: References: <443c240c0803041112w75a47baei1cb97337f943e5e9@mail.gmail.com> Message-ID: Like Dave said definitely check out the publisher api. If for some reason that isn't what you want, take a look at http://api.rubyonrails.org/classes/ActionController/UrlWriter.html to see how to include url helpers in any class. Michael Niessner On Mar 4, 2008, at 1:22 PM, David Clements wrote: > The new Publisher Api supports this have you looked at that? You have > access to all the view helpers and url_for. > > Are you pushing profile fbml? It supports that. > > Dave > > > On Tue, Mar 4, 2008 at 12:12 PM, Christopher Bailey > wrote: >> I'm building FBML in an asynchronous process, which is spawned from >> model >> code. There is no associated HTTP request, and thus no controller >> or view >> facilities available. I'm wondering if others do this, and what you >> recommend for building URL's (e.g. with lack of link_to and >> url_for, etc.)? >> >> -- >> Christopher Bailey >> Cobalt Edge LLC >> http://cobaltedge.com >> _______________________________________________ >> 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 From chris at cobaltedge.com Tue Mar 4 15:45:05 2008 From: chris at cobaltedge.com (Christopher Bailey) Date: Tue, 4 Mar 2008 12:45:05 -0800 Subject: [Facebooker-talk] How to build URL's in models/outside controller/view code? In-Reply-To: References: <443c240c0803041112w75a47baei1cb97337f943e5e9@mail.gmail.com> Message-ID: <443c240c0803041245k36eb54e0m44bf0bd3568980c5@mail.gmail.com> Ah, thanks for reminding me about that! Ok, I'm trying to use it now. I've built my class to publish a profile update for a user, as per Mike's message (in his response to you putting up the tutorial). But, when I call FacebookPublisher.deliver_profile_update(user), I get see this: NoMethodError (undefined method `send!' for #): .//vendor/plugins/facebooker/lib/facebooker/rails/publisher.rb:263:in `inherited' .//app/models/facebook_publisher.rb:1 Any ideas before I dig in further? I'm using the latest Facebooker (rev 200). On 3/4/08, David Clements wrote: > > The new Publisher Api supports this have you looked at that? You have > access to all the view helpers and url_for. > > Are you pushing profile fbml? It supports that. > > Dave > > > > On Tue, Mar 4, 2008 at 12:12 PM, Christopher Bailey > wrote: > > I'm building FBML in an asynchronous process, which is spawned from > model > > code. There is no associated HTTP request, and thus no controller or > view > > facilities available. I'm wondering if others do this, and what you > > recommend for building URL's (e.g. with lack of link_to and url_for, > etc.)? > > > > -- > > Christopher Bailey > > Cobalt Edge LLC > > http://cobaltedge.com > > > _______________________________________________ > > 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/20080304/74050967/attachment.html From brad at bradhubbard.net Tue Mar 4 16:30:22 2008 From: brad at bradhubbard.net (Brad Hubbard) Date: Tue, 4 Mar 2008 13:30:22 -0800 Subject: [Facebooker-talk] Profile Boxes Message-ID: <7b18dc380803041330y7ae5ae0ejacb0960054c93b86@mail.gmail.com> I'm authoring my first facebooker app and my first FB App - and trying to wrap my head around it all. I've gotten everything to work in the install/However, I'm not certain how to get the profile box to display/update. Are there any good tutorials or explanations of how to get Facebooker to update a users' profile box? I tried using profile_fbml=("Here is a bit of test data") as part of the successful install method in my controller, and have been consistently getting errors. Any tips would be greatly appreciated. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/facebooker-talk/attachments/20080304/e1234921/attachment.html From bjclark at scidept.com Tue Mar 4 16:42:12 2008 From: bjclark at scidept.com (BJ Clark) Date: Tue, 4 Mar 2008 14:42:12 -0700 Subject: [Facebooker-talk] Profile Boxes In-Reply-To: <7b18dc380803041330y7ae5ae0ejacb0960054c93b86@mail.gmail.com> References: <7b18dc380803041330y7ae5ae0ejacb0960054c93b86@mail.gmail.com> Message-ID: <56088AD0-E037-4297-9DE0-70D558EE75C1@scidept.com> Brad, I highly recommend making yourself very familiar with http://wiki.developers.facebook.com/index.php/Main_Page You're probably getting errors because of malformed api calls. You can see what's required for each call on the wiki. Good Luck, ----- BJ Clark the science department bjclark at scidept.com www.scidept.com On Mar 4, 2008, at 2:30 PM, Brad Hubbard wrote: > I'm authoring my first facebooker app and my first FB App - and > trying to wrap my head around it all. I've gotten everything to work > in the install/However, I'm not certain how to get the profile box > to display/update. Are there any good tutorials or explanations of > how to get Facebooker to update a users' profile box? > > I tried using profile_fbml=("Here is a bit of test data") as part of > the successful install method in my controller, and have been > consistently getting errors. > > Any tips would be greatly appreciated. > _______________________________________________ > Facebooker-talk mailing list > Facebooker-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/facebooker-talk From chris at cobaltedge.com Tue Mar 4 16:45:53 2008 From: chris at cobaltedge.com (Christopher Bailey) Date: Tue, 4 Mar 2008 13:45:53 -0800 Subject: [Facebooker-talk] Profile Boxes In-Reply-To: <7b18dc380803041330y7ae5ae0ejacb0960054c93b86@mail.gmail.com> References: <7b18dc380803041330y7ae5ae0ejacb0960054c93b86@mail.gmail.com> Message-ID: <443c240c0803041345k7ee269f7u57136d3819fe3de7@mail.gmail.com> Also, as I just learned, check out Facebooker's Publisher class to updating profile, sending notifications, etc. On 3/4/08, Brad Hubbard wrote: > > I'm authoring my first facebooker app and my first FB App - and trying to > wrap my head around it all. I've gotten everything to work in the > install/However, I'm not certain how to get the profile box to > display/update. Are there any good tutorials or explanations of how to get > Facebooker to update a users' profile box? > > I tried using profile_fbml=("Here is a bit of test data") as part of the > successful install method in my controller, and have been consistently > getting errors. > > Any tips would be greatly appreciated. > > _______________________________________________ > 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/20080304/ec30a040/attachment.html From chris at cobaltedge.com Tue Mar 4 17:10:55 2008 From: chris at cobaltedge.com (Christopher Bailey) Date: Tue, 4 Mar 2008 14:10:55 -0800 Subject: [Facebooker-talk] How to build URL's in models/outside controller/view code? In-Reply-To: <443c240c0803041245k36eb54e0m44bf0bd3568980c5@mail.gmail.com> References: <443c240c0803041112w75a47baei1cb97337f943e5e9@mail.gmail.com> <443c240c0803041245k36eb54e0m44bf0bd3568980c5@mail.gmail.com> Message-ID: <443c240c0803041410l39c512e6ya818d61807300546@mail.gmail.com> Well, it appears the fix for this was simply to change the call from "send!" to be "send" instead. My story gets sent that way. Is send! a Rails 2 addition possibly? I'm using Rails 1.2.3. On 3/4/08, Christopher Bailey wrote: > > Ah, thanks for reminding me about that! Ok, I'm trying to use it now. > I've built my class to publish a profile update for a user, as per Mike's > message (in his response to you putting up the tutorial). But, when I call > FacebookPublisher.deliver_profile_update(user), I get see this: > > NoMethodError (undefined method `send!' for #): > .//vendor/plugins/facebooker/lib/facebooker/rails/publisher.rb:263:in > `inherited' > .//app/models/facebook_publisher.rb:1 > > > Any ideas before I dig in further? I'm using the latest Facebooker (rev > 200). > > On 3/4/08, David Clements wrote: > > > > The new Publisher Api supports this have you looked at that? You have > > access to all the view helpers and url_for. > > > > Are you pushing profile fbml? It supports that. > > > > Dave > > > > > > > > On Tue, Mar 4, 2008 at 12:12 PM, Christopher Bailey > > wrote: > > > I'm building FBML in an asynchronous process, which is spawned from > > model > > > code. There is no associated HTTP request, and thus no controller or > > view > > > facilities available. I'm wondering if others do this, and what you > > > recommend for building URL's (e.g. with lack of link_to and url_for, > > etc.)? > > > > > > -- > > > Christopher Bailey > > > Cobalt Edge LLC > > > http://cobaltedge.com > > > > > _______________________________________________ > > > 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/20080304/457a75e2/attachment.html From jnylund at yahoo.com Tue Mar 4 17:19:39 2008 From: jnylund at yahoo.com (Joel Nylund) Date: Tue, 4 Mar 2008 17:19:39 -0500 Subject: [Facebooker-talk] Profile Boxes In-Reply-To: <7b18dc380803041330y7ae5ae0ejacb0960054c93b86@mail.gmail.com> References: <7b18dc380803041330y7ae5ae0ejacb0960054c93b86@mail.gmail.com> Message-ID: <38C6E3DB-0BC4-4917-9E6A-59FA3B7A6325@yahoo.com> Brad, you have to pass fbml markup to that method <% @userF.profile_fbml = 'Joel is a cool dude ' %> or <% @userF.profile_fbml = 'Joel is a cool dude' %> While were on this topic, are you guys putting settings/etc in the profile still? It seems to me since users can just remove the box but keep your app, its better to put settings inside your applications tab set, thats what im doing but I was wondering what others thought.. see my previous posting to debug api calls, or Davids approach in his tutorial (monkey patch) Joel On Mar 4, 2008, at 4:30 PM, Brad Hubbard wrote: > I'm authoring my first facebooker app and my first FB App - and > trying to wrap my head around it all. I've gotten everything to work > in the install/However, I'm not certain how to get the profile box > to display/update. Are there any good tutorials or explanations of > how to get Facebooker to update a users' profile box? > > I tried using profile_fbml=("Here is a bit of test data") as part of > the successful install method in my controller, and have been > consistently getting errors. > > Any tips would be greatly appreciated. > _______________________________________________ > Facebooker-talk mailing list > Facebooker-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/facebooker-talk From geraldbauer2007 at gmail.com Tue Mar 4 18:33:53 2008 From: geraldbauer2007 at gmail.com (Gerald Bauer) Date: Tue, 4 Mar 2008 15:33:53 -0800 Subject: [Facebooker-talk] Facebooker Q&A with David Clements - TravelersTable Facebooker Sighting Message-ID: <7e7cb8940803041533s2e1491d6r6a901b34348c9dce@mail.gmail.com> Hello, I've published a mini Q&A with David Clements about Facebooker, TravelersTable and the Facebooker Tutorial. Read more @ http://rfacebook.wordpress.com/2008/03/04/travelerstable Cheers. -- Gerald Bauer - Internet Professional - http://geraldbauer.wordpress.com From chris at cobaltedge.com Tue Mar 4 19:26:20 2008 From: chris at cobaltedge.com (Christopher Bailey) Date: Tue, 4 Mar 2008 16:26:20 -0800 Subject: [Facebooker-talk] Template path issues for Publisher Message-ID: <443c240c0803041626k397cbe96m6a6ffcd080fb3542@mail.gmail.com> I'm now dialed in on using Publisher, big thanks to Mike and folks for setting that up, it makes life much nicer! I have had to make two very small tweaks to the code to make it work for me. This is possibly due to us being on Rails 1.2.3 (my next chunk of work will be to get us to at least 1.2.6 and hopefully 2.x, but I need to finish the Facebook app first :) Anyway, I mentioned the first tweak in a previous email, but will cover both here for completeness, and any comments/info folks have: 1) In Publisher#inherited, it makes a call to send!, but send! is undefined in my environment. I simply changed this to call send (i.e. no exclamation point), and it all appears to work fine. 2) In Publisher#initialize_template_class, when it instantiates the ActionView::Base object, it passes in a template path that is an array holding both the base views directory, as well as the specific controller view subdirectory. In our environment, this yielded a second specific view directory name on the path when ActionView::Base#template_exists? went looking for the partial. For example, I'd see it looking for paths like: .../app/views/facebook_publisher/facebook_publisher/_profile.rhtml I don't now if it's different in Rails 2, and/or if the intent is that both those paths should be searched when looking for templates (and that array aspect simply didn't work in Rails 1.2.3?) or what. But, the fix was to remove the specific subdirectory, and thus change that line of code to: returning ActionView::Base.new(template_root, assigns, self) do |template| I've marked up my code and will revisit this once I get our codebase moved to Rails 2, but wanted to put this out there in case had further info, or in case this might help someone else. -- Christopher Bailey Cobalt Edge LLC http://cobaltedge.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/facebooker-talk/attachments/20080304/01773f3a/attachment.html From joel at i5labs.com Tue Mar 4 19:46:49 2008 From: joel at i5labs.com (Joel Watson) Date: Tue, 4 Mar 2008 16:46:49 -0800 Subject: [Facebooker-talk] Can someone tell me if this is possible In-Reply-To: References: Message-ID: The session key is accessible with "your_session.session_key". So, by default in your facebook controller with the requisite ensure filters, you will have a session accessible via facebook_session. So, you would get it like this: class FacebookController < ApplicationController ensure_application_is_installed_by_facebook_user def some_action @user = User.new @user.facebook_session_key = facebook_session.session_key @user.facebook_uid = facebook_session.user.uid @user.save end end Is that what you were after? -Joel On Mar 4, 2008, at 9:07 AM, Michael Tedesco wrote: > Thanks Joel: > > Does facebooker have a similar function to the following - to > return facebook generated session key > > facebook.auth.getSession ? > > n Thanks, Mike -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/facebooker-talk/attachments/20080304/d5c3cd5d/attachment.html From joel at i5labs.com Tue Mar 4 19:54:54 2008 From: joel at i5labs.com (Joel Watson) Date: Tue, 4 Mar 2008 16:54:54 -0800 Subject: [Facebooker-talk] Profile Boxes In-Reply-To: <38C6E3DB-0BC4-4917-9E6A-59FA3B7A6325@yahoo.com> References: <7b18dc380803041330y7ae5ae0ejacb0960054c93b86@mail.gmail.com> <38C6E3DB-0BC4-4917-9E6A-59FA3B7A6325@yahoo.com> Message-ID: <9F754269-98DC-48D6-AE5F-1B29BAECA49E@i5labs.com> Probably worth mentioning that the example for the Publisher methods in the rdocs are not accurate. For example, the rdocs give this as an example to update the user profile: def profile_update(user_to_update,user_with_session_to_use) from user_with_session_to_use to user_to_update profile render(:action=>"/users/ profile",:assigns=>{:user=>user_to_update}) end However, you need something more like this: def profile_update(user_to_update,user_with_session_to_user) send_as :profile from user_with_session_to_use recipients user_to_update profile render(:action=>"/users/ profile",:assigns=>{:user=>user_to_update}) end Notice the lack of the send_as :profile in the rdoc example and "to" changing to "recipients". This is also the case with templatized actions. Just FYI. -Joel From chris at cobaltedge.com Tue Mar 4 20:04:49 2008 From: chris at cobaltedge.com (Christopher Bailey) Date: Tue, 4 Mar 2008 17:04:49 -0800 Subject: [Facebooker-talk] Profile Boxes In-Reply-To: <9F754269-98DC-48D6-AE5F-1B29BAECA49E@i5labs.com> References: <7b18dc380803041330y7ae5ae0ejacb0960054c93b86@mail.gmail.com> <38C6E3DB-0BC4-4917-9E6A-59FA3B7A6325@yahoo.com> <9F754269-98DC-48D6-AE5F-1B29BAECA49E@i5labs.com> Message-ID: <443c240c0803041704g63f15733ke8585fb7ee67eee3@mail.gmail.com> And I've had problems using full actions, so am using partials instead (which actually is more intuitive to me given that you aren't generating a whole page, but just a snippet of FBML for use in a page, but whatever). Anyway, assuming for something like a profile that the user himself is who is updating his profile (not sure it's "legal" to have one user update another's profile :) I have this: def profile_update(user) send_as :profile recipients user profile render(:partial => "profile", :assigns => { :user => user }) end On 3/4/08, Joel Watson wrote: > > Probably worth mentioning that the example for the Publisher methods > in the rdocs are not accurate. For example, the rdocs give this as an > example to update the user profile: > > def profile_update(user_to_update,user_with_session_to_use) > from user_with_session_to_use > to user_to_update > profile render(:action=>"/users/ > profile",:assigns=>{:user=>user_to_update}) > end > > However, you need something more like this: > > def profile_update(user_to_update,user_with_session_to_user) > send_as :profile > from user_with_session_to_use > recipients user_to_update > profile render(:action=>"/users/ > profile",:assigns=>{:user=>user_to_update}) > end > > Notice the lack of the send_as :profile in the rdoc example and "to" > changing to "recipients". This is also the case with templatized > actions. Just FYI. > -Joel > _______________________________________________ > 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/20080304/bc60e49b/attachment.html From chris at cobaltedge.com Tue Mar 4 23:46:02 2008 From: chris at cobaltedge.com (Christopher Bailey) Date: Tue, 4 Mar 2008 20:46:02 -0800 Subject: [Facebooker-talk] How to build URL's in models/outside controller/view code? In-Reply-To: <443c240c0803041410l39c512e6ya818d61807300546@mail.gmail.com> References: <443c240c0803041112w75a47baei1cb97337f943e5e9@mail.gmail.com> <443c240c0803041245k36eb54e0m44bf0bd3568980c5@mail.gmail.com> <443c240c0803041410l39c512e6ya818d61807300546@mail.gmail.com> Message-ID: <443c240c0803042046ma1cbd02x10c6617a655afd24@mail.gmail.com> Further followup... So, the Publisher solution doesn't seem to actually solve my need for URL generation. link_to, url_for, image_tag, and so on don't seem to work (I get various undefined method errors for methods they use, etc.). Is that expected, or? On 3/4/08, Christopher Bailey wrote: > > Well, it appears the fix for this was simply to change the call from > "send!" to be "send" instead. My story gets sent that way. Is send! a > Rails 2 addition possibly? I'm using Rails 1.2.3. > > On 3/4/08, Christopher Bailey wrote: > > > > Ah, thanks for reminding me about that! Ok, I'm trying to use it now. > > I've built my class to publish a profile update for a user, as per Mike's > > message (in his response to you putting up the tutorial). But, when I call > > FacebookPublisher.deliver_profile_update(user), I get see this: > > > > NoMethodError (undefined method `send!' for #): > > > > .//vendor/plugins/facebooker/lib/facebooker/rails/publisher.rb:263:in > > `inherited' > > .//app/models/facebook_publisher.rb:1 > > > > > > Any ideas before I dig in further? I'm using the latest Facebooker (rev > > 200). > > > > On 3/4/08, David Clements wrote: > > > > > > The new Publisher Api supports this have you looked at that? You have > > > access to all the view helpers and url_for. > > > > > > Are you pushing profile fbml? It supports that. > > > > > > Dave > > > > > > > > > > > > On Tue, Mar 4, 2008 at 12:12 PM, Christopher Bailey > > > wrote: > > > > I'm building FBML in an asynchronous process, which is spawned from > > > model > > > > code. There is no associated HTTP request, and thus no controller > > > or view > > > > facilities available. I'm wondering if others do this, and what you > > > > recommend for building URL's (e.g. with lack of link_to and url_for, > > > etc.)? > > > > > > > > -- > > > > Christopher Bailey > > > > Cobalt Edge LLC > > > > http://cobaltedge.com > > > > > > > _______________________________________________ > > > > 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/20080304/5c90dc45/attachment-0001.html From michael.tedesco at peermeta.com Wed Mar 5 14:00:29 2008 From: michael.tedesco at peermeta.com (Michael Tedesco) Date: Wed, 5 Mar 2008 14:00:29 -0500 Subject: [Facebooker-talk] Is there a Facebooker method call that I can do the following Message-ID: I'd like to be able to do the following without using ensure_authenticated_to_facebook from "http://www.facebook.com/login.php?api_key="+key+"&v=1.0" Capture the Session key as well as the logged in user I realize I have access to these values through facebook_session if I include that method, But if I don't use it, can I do for instance Facebook.auth.getSession (an equivalent facebooker command) Then Get user -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/facebooker-talk/attachments/20080305/7295eca5/attachment.html From jbulmer at spheric.ca Wed Mar 5 14:59:37 2008 From: jbulmer at spheric.ca (Jaime Bulmer) Date: Wed, 5 Mar 2008 15:59:37 -0400 Subject: [Facebooker-talk] Fan Pages and Sessions Message-ID: <79CFFF97-96A9-4AE9-B824-21FF41C6F009@spheric.ca> I'm a ruby nuby trying to get through my first Facebooker application. I have two issues I need support with. First is that another user of the application was accessing it find and now all of a sudden he gets: Facebooker::Session::SessionExpired (Session key invalid or no longer valid): How do we go about solving that? Second is that facebook has an api call for pages.isFan How can I do this call with Facebooker? Please Help From brad at bradhubbard.net Wed Mar 5 16:10:59 2008 From: brad at bradhubbard.net (Brad Hubbard) Date: Wed, 5 Mar 2008 13:10:59 -0800 Subject: [Facebooker-talk] Profile Boxes In-Reply-To: <443c240c0803041704g63f15733ke8585fb7ee67eee3@mail.gmail.com> References: <7b18dc380803041330y7ae5ae0ejacb0960054c93b86@mail.gmail.com> <38C6E3DB-0BC4-4917-9E6A-59FA3B7A6325@yahoo.com> <9F754269-98DC-48D6-AE5F-1B29BAECA49E@i5labs.com> <443c240c0803041704g63f15733ke8585fb7ee67eee3@mail.gmail.com> Message-ID: <7b18dc380803051310g46b1344egf7e4e537a5d36e5@mail.gmail.com> I tried moving over to the Facebooker publisher method. My publisher controller is: class PublisherController < Facebooker::Rails::Publisher def profile_update(user) send_as :profile recipients user profile render(:partial => "profile", :assigns => { :user => user }) end end My partial is _profile.erb: Not working just yet. One can always hope! And my canvas controller calls: PublisherController.deliver_profile_update(@fb_user) I get (in my error logs): Facebooker::Rails::Publisher::UnknownBodyType (Unknown type to publish): I've got "send as :profile" in there - I'm not sure what I'm doing wrong. -Brad On Tue, Mar 4, 2008 at 5:04 PM, Christopher Bailey wrote: > And I've had problems using full actions, so am using partials instead > (which actually is more intuitive to me given that you aren't generating a > whole page, but just a snippet of FBML for use in a page, but whatever). > Anyway, assuming for something like a profile that the user himself is who > is updating his profile (not sure it's "legal" to have one user update > another's profile :) I have this: > > def profile_update(user) > send_as :profile > recipients user > profile render(:partial => "profile", :assigns => { :user => user }) > end > > > > On 3/4/08, Joel Watson wrote: > > > Probably worth mentioning that the example for the Publisher methods > > in the rdocs are not accurate. For example, the rdocs give this as an > > example to update the user profile: > > > > def profile_update(user_to_update,user_with_session_to_use) > > from user_with_session_to_use > > to user_to_update > > profile render(:action=>"/users/ > > profile",:assigns=>{:user=>user_to_update}) > > end > > > > However, you need something more like this: > > > > def profile_update(user_to_update,user_with_session_to_user) > > send_as :profile > > from user_with_session_to_use > > recipients user_to_update > > profile render(:action=>"/users/ > > profile",:assigns=>{:user=>user_to_update}) > > end > > > > Notice the lack of the send_as :profile in the rdoc example and "to" > > changing to "recipients". This is also the case with templatized > > actions. Just FYI. > > -Joel > > _______________________________________________ > > 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/20080305/69f3c0a6/attachment.html From joel at i5labs.com Wed Mar 5 16:38:35 2008 From: joel at i5labs.com (Joel Watson) Date: Wed, 5 Mar 2008 13:38:35 -0800 Subject: [Facebooker-talk] Profile Boxes In-Reply-To: <7b18dc380803051310g46b1344egf7e4e537a5d36e5@mail.gmail.com> References: <7b18dc380803041330y7ae5ae0ejacb0960054c93b86@mail.gmail.com> <38C6E3DB-0BC4-4917-9E6A-59FA3B7A6325@yahoo.com> <9F754269-98DC-48D6-AE5F-1B29BAECA49E@i5labs.com> <443c240c0803041704g63f15733ke8585fb7ee67eee3@mail.gmail.com> <7b18dc380803051310g46b1344egf7e4e537a5d36e5@mail.gmail.com> Message-ID: What version of rails are you using? If you're using Rails 2.x and your partial is actually named "_profile.erb", then you might try renaming it to "_profile.html.erb". Not sure if that has anything to do with it, but worth a shot. -Joel On Mar 5, 2008, at 1:10 PM, Brad Hubbard wrote: > I tried moving over to the Facebooker publisher method. > > My publisher controller is: > class PublisherController < Facebooker::Rails::Publisher > def profile_update(user) > send_as :profile > recipients user > profile render(:partial => "profile", :assigns => { :user => > user }) > end > end > > My partial is _profile.erb: > Not working just yet. One can always hope! > > And my canvas controller calls: > PublisherController.deliver_profile_update(@fb_user) > > I get (in my error logs): > Facebooker::Rails::Publisher::UnknownBodyType (Unknown type to > publish): > I've got "send as :profile" in there - I'm not sure what I'm doing > wrong. > > -Brad From digidigo at gmail.com Wed Mar 5 16:42:04 2008 From: digidigo at gmail.com (David Clements) Date: Wed, 5 Mar 2008 14:42:04 -0700 Subject: [Facebooker-talk] Is there a Facebooker method call that I can do the following In-Reply-To: References: Message-ID: Hey Michael, I am not sure if I am following you here. That URL does not hit your server at all. That is handled by the facebook servers. If facebook is hitting your server all the data you are looking for should be in the params hash though: params[:fb_sig_session_key] params[:fb_sig_user] Dave On Wed, Mar 5, 2008 at 12:00 PM, Michael Tedesco wrote: > > > > > I'd like to be able to do the following without using > ensure_authenticated_to_facebook > > from > > "http://www.facebook.com/login.php?api_key="+key+"&v=1.0" > > > > Capture the Session key as well as the logged in user > > I realize I have access to these values through facebook_session if I > include that method, > > > > But if I don't use it, can I do for instance > > Facebook.auth.getSession (an equivalent facebooker command) > > Then > > Get user > _______________________________________________ > Facebooker-talk mailing list > Facebooker-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/facebooker-talk > > From chris at cobaltedge.com Wed Mar 5 20:12:43 2008 From: chris at cobaltedge.com (Christopher Bailey) Date: Wed, 5 Mar 2008 17:12:43 -0800 Subject: [Facebooker-talk] Setting :canvas => false for URL generation doesn't always work? Message-ID: <443c240c0803051712x7606f6f1n24e7c2830e0c3452@mail.gmail.com> I generate a lot of URL's in my Facebook related code that point to our main site, not our FB app. My understanding was that the way to do this was to use ":canvas => false" as a parameter to url_for and link_to and so on. However, that doesn't seem to generate the proper URL's. The URL's still point to apps.facebook.com (because they don't have a host/are relative). Interestingly, if I use a named route, and pass :canvas=>false to it, then it generates the proper URL (and if I leave canvas param off or set to true, it sets it to apps.facebook.com, so it's definitely taking it into account). I'm wondering if someone can comment on this more? I have a fix, but I'm not sure if it's actually a fix, or just solving the symptom or improper use on my part, etc. What I did to fix it was change Facebooker's UrlRewriter#link_to_canvas? (in facebook_url_rewriting.rb) to look like this: def link_to_canvas?(params, options) option_override = options[:canvas] if option_override == false # important to check for false. nil should use default behavior options[:only_path] = false RAILS_DEFAULT_LOGGER.debug "set options[:only_path] to false" return false end option_override || @request.parameters["fb_sig_in_canvas"] == "1" || @request.parameters[:fb_sig_in_canvas] == "1" end The pertinent change is that if they sent canvas to false, I add the "only_path" option and set it to false. I'm also seeing a problem related to this with the Publisher class, but I'll bring that up separately, as it's a different kind of issue. -- Christopher Bailey Cobalt Edge LLC http://cobaltedge.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/facebooker-talk/attachments/20080305/36171c9c/attachment.html From mmangino at elevatedrails.com Wed Mar 5 20:43:12 2008 From: mmangino at elevatedrails.com (Mike Mangino) Date: Wed, 5 Mar 2008 19:43:12 -0600 Subject: [Facebooker-talk] Setting :canvas => false for URL generation doesn't always work? In-Reply-To: <443c240c0803051712x7606f6f1n24e7c2830e0c3452@mail.gmail.com> References: <443c240c0803051712x7606f6f1n24e7c2830e0c3452@mail.gmail.com> Message-ID: <2AFDE28D-6B4E-4BE0-A6CA-8B0B624AEB26@elevatedrails.com> This is a problem that comes because the developer (me) doesn't use url_for. I've used named routes only for more than a year now. What version of rails are you using? That's probably the first thing we'll need to track this down. Also, any sample code would be helpful, especially if you can make it fail in a test. Mike On Mar 5, 2008, at 7:12 PM, Christopher Bailey wrote: > I generate a lot of URL's in my Facebook related code that point to > our main site, not our FB app. My understanding was that the way to > do this was to use ":canvas => false" as a parameter to url_for and > link_to and so on. However, that doesn't seem to generate the > proper URL's. The URL's still point to apps.facebook.com (because > they don't have a host/are relative). Interestingly, if I use a > named route, and pass :canvas=>false to it, then it generates the > proper URL (and if I leave canvas param off or set to true, it sets > it to apps.facebook.com, so it's definitely taking it into account). > > > I'm wondering if someone can comment on this more? I have a fix, > but I'm not sure if it's actually a fix, or just solving the symptom > or improper use on my part, etc. What I did to fix it was change > Facebooker's UrlRewriter#link_to_canvas? (in > facebook_url_rewriting.rb) to look like this: > > > def link_to_canvas?(params, options) > option_override = options[:canvas] > if option_override == false # important to check for false. > nil should use default behavior > options[:only_path] = false > RAILS_DEFAULT_LOGGER.debug "set options[:only_path] to false" > return false > end > option_override || @request.parameters["fb_sig_in_canvas"] == > "1" || @request.parameters[:fb_sig_in_canvas] == "1" > end > > > The pertinent change is that if they sent canvas to false, I add the > "only_path" option and set it to false. > > > I'm also seeing a problem related to this with the Publisher class, > but I'll bring that up separately, as it's a different kind of issue. > > -- > Christopher Bailey > Cobalt Edge LLC > http://cobaltedge.com > _______________________________________________ > Facebooker-talk mailing list > Facebooker-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/facebooker-talk -- Mike Mangino http://www.elevatedrails.com From mniessner at elevatedrails.com Wed Mar 5 21:08:04 2008 From: mniessner at elevatedrails.com (Michael Niessner) Date: Wed, 5 Mar 2008 20:08:04 -0600 Subject: [Facebooker-talk] Setting :canvas => false for URL generation doesn't always work? In-Reply-To: <2AFDE28D-6B4E-4BE0-A6CA-8B0B624AEB26@elevatedrails.com> References: <443c240c0803051712x7606f6f1n24e7c2830e0c3452@mail.gmail.com> <2AFDE28D-6B4E-4BE0-A6CA-8B0B624AEB26@elevatedrails.com> Message-ID: :canvas => true/false will not work in any version of rails if :only_path => true. The rails docs state that by default url_for sets :only_path => true. So if you wanted url_for to give you a full url and not a path you would have to do url_for(blah, :only_path => false). And if you wanted to use :canvas you'd have to do url_for(blah, :only_path => false, :canvas => true/false). Since canvas only correctly when :only_path => false, it might make sense to check if :canvas is not nil and then set :only_path => false. Although, that has the side effect of having something_path(:canvas => true/false) return a fully qualified url instead of a path. If it is decided that have something_path(:canvas => true/false) return a url instead of path is better than having to explicitly set :only_path => false when using url_for with :canvas then the method should probably look more like the following, since you will want the host to be added both when 1) linking to a facebook url from a non facebook page and 2) linking to a non facebook url from a facebook page. def link_to_canvas?(params, options) option_override = options[:canvas] options[:only_path] = false if !option_override.nil? if option_override == false # important to check for false. nil should use default behavior return false end option_override || @request.parameters["fb_sig_in_canvas"] == "1" || @request.parameters[:fb_sig_in_canvas] == "1" end Michael Niessner On Mar 5, 2008, at 7:43 PM, Mike Mangino wrote: > This is a problem that comes because the developer (me) doesn't use > url_for. I've used named routes only for more than a year now. > > What version of rails are you using? That's probably the first thing > we'll need to track this down. Also, any sample code would be helpful, > especially if you can make it fail in a test. > > Mike > > > On Mar 5, 2008, at 7:12 PM, Christopher Bailey wrote: > >> I generate a lot of URL's in my Facebook related code that point to >> our main site, not our FB app. My understanding was that the way to >> do this was to use ":canvas => false" as a parameter to url_for and >> link_to and so on. However, that doesn't seem to generate the >> proper URL's. The URL's still point to apps.facebook.com (because >> they don't have a host/are relative). Interestingly, if I use a >> named route, and pass :canvas=>false to it, then it generates the >> proper URL (and if I leave canvas param off or set to true, it sets >> it to apps.facebook.com, so it's definitely taking it into account). >> >> >> I'm wondering if someone can comment on this more? I have a fix, >> but I'm not sure if it's actually a fix, or just solving the symptom >> or improper use on my part, etc. What I did to fix it was change >> Facebooker's UrlRewriter#link_to_canvas? (in >> facebook_url_rewriting.rb) to look like this: >> >> >> def link_to_canvas?(params, options) >> option_override = options[:canvas] >> if option_override == false # important to check for false. >> nil should use default behavior >> options[:only_path] = false >> RAILS_DEFAULT_LOGGER.debug "set options[:only_path] to false" >> return false >> end >> option_override || @request.parameters["fb_sig_in_canvas"] == >> "1" || @request.parameters[:fb_sig_in_canvas] == "1" >> end >> >> >> The pertinent change is that if they sent canvas to false, I add the >> "only_path" option and set it to false. >> >> >> I'm also seeing a problem related to this with the Publisher class, >> but I'll bring that up separately, as it's a different kind of issue. >> >> -- >> Christopher Bailey >> Cobalt Edge LLC >> http://cobaltedge.com >> _______________________________________________ >> Facebooker-talk mailing list >> Facebooker-talk at rubyforge.org >> http://rubyforge.org/mailman/listinfo/facebooker-talk > > -- > Mike Mangino > http://www.elevatedrails.com > > > _______________________________________________ > Facebooker-talk mailing list > Facebooker-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/facebooker-talk From chris at cobaltedge.com Wed Mar 5 21:21:04 2008 From: chris at cobaltedge.com (Christopher Bailey) Date: Wed, 5 Mar 2008 18:21:04 -0800 Subject: [Facebooker-talk] Setting :canvas => false for URL generation doesn't always work? In-Reply-To: <2AFDE28D-6B4E-4BE0-A6CA-8B0B624AEB26@elevatedrails.com> References: <443c240c0803051712x7606f6f1n24e7c2830e0c3452@mail.gmail.com> <2AFDE28D-6B4E-4BE0-A6CA-8B0B624AEB26@elevatedrails.com> Message-ID: <443c240c0803051821v1b5d0e1fh1fdff3953b5e837@mail.gmail.com> I figured that might be the case (devs only use named routes). Named routes are awesome, but simply not practical for our app (think thousands of routes). We are using Rails 1.2.3, and I will be moving up to Rails 2 when I can, but that is not a small task, and I was hoping to get the Facebook implementation done first (although the more I run into these things, the more I start to think about spiking on the Rails update). The behavior, at least as far as I can tell, actually makes sense. If you don't specify the only_path = false aspect, it defaults to true as per Rails docs, so of course it's not going to put the full host in there, and thus a relative path is going to resolve to apps.facebook.com. I'll see if I can't put a simple test case together and submit that so you have something. I'm wondering what other folks have seen who may be using url_for or link_to, if anyone is. If folks are doing Facebook only apps, then it's something they won't have come across, but for these apps that are their own site, as well as have the Facebook portion integrated into that same web app, it's an issue. Thanks for discussing. On 3/5/08, Mike Mangino wrote: > > This is a problem that comes because the developer (me) doesn't use > url_for. I've used named routes only for more than a year now. > > What version of rails are you using? That's probably the first thing > we'll need to track this down. Also, any sample code would be helpful, > especially if you can make it fail in a test. > > Mike > > > > On Mar 5, 2008, at 7:12 PM, Christopher Bailey wrote: > > > I generate a lot of URL's in my Facebook related code that point to > > our main site, not our FB app. My understanding was that the way to > > do this was to use ":canvas => false" as a parameter to url_for and > > link_to and so on. However, that doesn't seem to generate the > > proper URL's. The URL's still point to apps.facebook.com (because > > they don't have a host/are relative). Interestingly, if I use a > > named route, and pass :canvas=>false to it, then it generates the > > proper URL (and if I leave canvas param off or set to true, it sets > > it to apps.facebook.com, so it's definitely taking it into account). > > > > > > I'm wondering if someone can comment on this more? I have a fix, > > but I'm not sure if it's actually a fix, or just solving the symptom > > or improper use on my part, etc. What I did to fix it was change > > Facebooker's UrlRewriter#link_to_canvas? (in > > facebook_url_rewriting.rb) to look like this: > > > > > > def link_to_canvas?(params, options) > > option_override = options[:canvas] > > if option_override == false # important to check for false. > > nil should use default behavior > > options[:only_path] = false > > RAILS_DEFAULT_LOGGER.debug "set options[:only_path] to false" > > return false > > end > > option_override || @request.parameters["fb_sig_in_canvas"] == > > "1" || @request.parameters[:fb_sig_in_canvas] == "1" > > end > > > > > > The pertinent change is that if they sent canvas to false, I add the > > "only_path" option and set it to false. > > > > > > I'm also seeing a problem related to this with the Publisher class, > > but I'll bring that up separately, as it's a different kind of issue. > > > > -- > > Christopher Bailey > > Cobalt Edge LLC > > http://cobaltedge.com > > > _______________________________________________ > > Facebooker-talk mailing list > > Facebooker-talk at rubyforge.org > > http://rubyforge.org/mailman/listinfo/facebooker-talk > > > -- > 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/20080305/fa36a20f/attachment.html From chris at cobaltedge.com Wed Mar 5 23:07:08 2008 From: chris at cobaltedge.com (Christopher Bailey) Date: Wed, 5 Mar 2008 20:07:08 -0800 Subject: [Facebooker-talk] Setting :canvas => false for URL generation doesn't always work? In-Reply-To: References: <443c240c0803051712x7606f6f1n24e7c2830e0c3452@mail.gmail.com> <2AFDE28D-6B4E-4BE0-A6CA-8B0B624AEB26@elevatedrails.com> Message-ID: <443c240c0803052007m3b254b30id12bef0dbd789b42@mail.gmail.com> Michael, good point - I will likely at some point want to link directly into our FB app from the product as well (right now I only link to the FB app itself, so fairly straight forward). Thanks! On 3/5/08, Michael Niessner wrote: > > :canvas => true/false will not work in any version of rails > if :only_path => true. The rails docs state that by default url_for > sets :only_path => true. So if you wanted url_for to give you a full > url and not a path you would have to do url_for(blah, :only_path => > false). And if you wanted to use :canvas you'd have to do > url_for(blah, :only_path => false, :canvas => true/false). > > Since canvas only correctly when :only_path => false, it might make > sense to check if :canvas is not nil and then set :only_path => false. > Although, that has the side effect of having something_path(:canvas => > true/false) return a fully qualified url instead of a path. > > If it is decided that have something_path(:canvas => true/false) > return a url instead of path is better than having to explicitly > set :only_path => false when using url_for with :canvas then the > method should probably look more like the following, since you will > want the host to be added both when 1) linking to a facebook url from > a non facebook page and 2) linking to a non facebook url from a > facebook page. > > > def link_to_canvas?(params, options) > option_override = options[:canvas] > > options[:only_path] = false if !option_override.nil? > > if option_override == false # important to check for false. nil > should use default behavior > > return false > end > option_override || @request.parameters["fb_sig_in_canvas"] == > "1" || @request.parameters[:fb_sig_in_canvas] == "1" > end > > > Michael Niessner > > > On Mar 5, 2008, at 7:43 PM, Mike Mangino wrote: > > > This is a problem that comes because the developer (me) doesn't use > > url_for. I've used named routes only for more than a year now. > > > > What version of rails are you using? That's probably the first thing > > we'll need to track this down. Also, any sample code would be helpful, > > especially if you can make it fail in a test. > > > > Mike > > > > > > On Mar 5, 2008, at 7:12 PM, Christopher Bailey wrote: > > > >> I generate a lot of URL's in my Facebook related code that point to > >> our main site, not our FB app. My understanding was that the way to > >> do this was to use ":canvas => false" as a parameter to url_for and > >> link_to and so on. However, that doesn't seem to generate the > >> proper URL's. The URL's still point to apps.facebook.com (because > >> they don't have a host/are relative). Interestingly, if I use a > >> named route, and pass :canvas=>false to it, then it generates the > >> proper URL (and if I leave canvas param off or set to true, it sets > >> it to apps.facebook.com, so it's definitely taking it into account). > >> > >> > >> I'm wondering if someone can comment on this more? I have a fix, > >> but I'm not sure if it's actually a fix, or just solving the symptom > >> or improper use on my part, etc. What I did to fix it was change > >> Facebooker's UrlRewriter#link_to_canvas? (in > >> facebook_url_rewriting.rb) to look like this: > >> > >> > >> def link_to_canvas?(params, options) > >> option_override = options[:canvas] > >> if option_override == false # important to check for false. > >> nil should use default behavior > >> options[:only_path] = false > >> RAILS_DEFAULT_LOGGER.debug "set options[:only_path] to false" > >> return false > >> end > >> option_override || @request.parameters["fb_sig_in_canvas"] == > >> "1" || @request.parameters[:fb_sig_in_canvas] == "1" > >> end > >> > >> > >> The pertinent change is that if they sent canvas to false, I add the > >> "only_path" option and set it to false. > >> > >> > >> I'm also seeing a problem related to this with the Publisher class, > >> but I'll bring that up separately, as it's a different kind of issue. > >> > >> -- > >> Christopher Bailey > >> Cobalt Edge LLC > >> http://cobaltedge.com > >> _______________________________________________ > >> Facebooker-talk mailing list > >> Facebooker-talk at rubyforge.org > >> http://rubyforge.org/mailman/listinfo/facebooker-talk > > > > -- > > Mike Mangino > > http://www.elevatedrails.com > > > > > > _______________________________________________ > > 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/20080305/8f0488f0/attachment-0001.html From mmangino at elevatedrails.com Wed Mar 5 23:23:06 2008 From: mmangino at elevatedrails.com (Mike Mangino) Date: Wed, 5 Mar 2008 22:23:06 -0600 Subject: [Facebooker-talk] Setting :canvas => false for URL generation doesn't always work? In-Reply-To: <443c240c0803052007m3b254b30id12bef0dbd789b42@mail.gmail.com> References: <443c240c0803051712x7606f6f1n24e7c2830e0c3452@mail.gmail.com> <2AFDE28D-6B4E-4BE0-A6CA-8B0B624AEB26@elevatedrails.com> <443c240c0803052007m3b254b30id12bef0dbd789b42@mail.gmail.com> Message-ID: <38C0968C-81AD-40F4-90D3-1540DB2DC2B4@elevatedrails.com> If you find yourself always setting only_path to false, you can always set this as a default_url_option. We should definitely add that to the docs. Mike On Mar 5, 2008, at 10:07 PM, Christopher Bailey wrote: > Michael, good point - I will likely at some point want to link > directly into our FB app from the product as well (right now I only > link to the FB app itself, so fairly straight forward). Thanks! > > On 3/5/08, Michael Niessner > wrote: :canvas => true/false will not work in any version of rails > if :only_path => true. The rails docs state that by default url_for > sets :only_path => true. So if you wanted url_for to give you a full > url and not a path you would have to do url_for(blah, :only_path => > false). And if you wanted to use :canvas you'd have to do > url_for(blah, :only_path => false, :canvas => true/false). > > Since canvas only correctly when :only_path => false, it might make > sense to check if :canvas is not nil and then set :only_path => false. > Although, that has the side effect of having something_path(:canvas => > true/false) return a fully qualified url instead of a path. > > If it is decided that have something_path(:canvas => true/false) > return a url instead of path is better than having to explicitly > set :only_path => false when using url_for with :canvas then the > method should probably look more like the following, since you will > want the host to be added both when 1) linking to a facebook url from > a non facebook page and 2) linking to a non facebook url from a > facebook page. > > > def link_to_canvas?(params, options) > option_override = options[:canvas] > > options[:only_path] = false if !option_override.nil? > > if option_override == false # important to check for false. nil > should use default behavior > > return false > end > option_override || @request.parameters["fb_sig_in_canvas"] == > "1" || @request.parameters[:fb_sig_in_canvas] == "1" > end > > > Michael Niessner > > > On Mar 5, 2008, at 7:43 PM, Mike Mangino wrote: > > > This is a problem that comes because the developer (me) doesn't use > > url_for. I've used named routes only for more than a year now. > > > > What version of rails are you using? That's probably the first thing > > we'll need to track this down. Also, any sample code would be > helpful, > > especially if you can make it fail in a test. > > > > Mike > > > > > > On Mar 5, 2008, at 7:12 PM, Christopher Bailey wrote: > > > >> I generate a lot of URL's in my Facebook related code that point to > >> our main site, not our FB app. My understanding was that the way > to > >> do this was to use ":canvas => false" as a parameter to url_for and > >> link_to and so on. However, that doesn't seem to generate the > >> proper URL's. The URL's still point to apps.facebook.com (because > >> they don't have a host/are relative). Interestingly, if I use a > >> named route, and pass :canvas=>false to it, then it generates the > >> proper URL (and if I leave canvas param off or set to true, it sets > >> it to apps.facebook.com, so it's definitely taking it into > account). > >> > >> > >> I'm wondering if someone can comment on this more? I have a fix, > >> but I'm not sure if it's actually a fix, or just solving the > symptom > >> or improper use on my part, etc. What I did to fix it was change > >> Facebooker's UrlRewriter#link_to_canvas? (in > >> facebook_url_rewriting.rb) to look like this: > >> > >> > >> def link_to_canvas?(params, options) > >> option_override = options[:canvas] > >> if option_override == false # important to check for false. > >> nil should use default behavior > >> options[:only_path] = false > >> RAILS_DEFAULT_LOGGER.debug "set options[:only_path] to > false" > >> return false > >> end > >> option_override || @request.parameters["fb_sig_in_canvas"] == > >> "1" || @request.parameters[:fb_sig_in_canvas] == "1" > >> end > >> > >> > >> The pertinent change is that if they sent canvas to false, I add > the > >> "only_path" option and set it to false. > >> > >> > >> I'm also seeing a problem related to this with the Publisher class, > >> but I'll bring that up separately, as it's a different kind of > issue. > >> > >> -- > >> Christopher Bailey > >> Cobalt Edge LLC > >> http://cobaltedge.com > >> _______________________________________________ > >> Facebooker-talk mailing list > >> Facebooker-talk at rubyforge.org > >> http://rubyforge.org/mailman/listinfo/facebooker-talk > > > > -- > > Mike Mangino > > http://www.elevatedrails.com > > > > > > _______________________________________________ > > Facebooker-talk mailing list > > Facebooker-talk at rubyforge.org > > http://rubyforge.org/mailman/listinfo/facebooker-talk > > > > > -- > Christopher Bailey > Cobalt Edge LLC > http://cobaltedge.com -- Mike Mangino http://www.elevatedrails.com From sbwoodside at yahoo.com Wed Mar 5 23:38:48 2008 From: sbwoodside at yahoo.com (S. Woodside) Date: Wed, 5 Mar 2008 23:38:48 -0500 Subject: [Facebooker-talk] patches on the rubyforge tracker Message-ID: <6ADCC99E-E6AE-4FE3-AB42-95B9DD773C7F@yahoo.com> Hi I just made some changes / additions for myself in facebooker and posted the patches on rubyforge, e.g.: https://rubyforge.org/tracker/index.php? func=detail&aid=18639&group_id=4187&atid=16130 (adds support for fb:dialog FBML tag) Is this the right way to do it? --simon -- http://simonwoodside.com From sbwoodside at yahoo.com Wed Mar 5 23:49:50 2008 From: sbwoodside at yahoo.com (S. Woodside) Date: Wed, 5 Mar 2008 23:49:50 -0500 Subject: [Facebooker-talk] Profile Boxes Message-ID: <2E6C7374-744B-4C6F-A5C7-78EE9EA7A5A3@yahoo.com> Well, if you do a search in the facebooker code you'll see that only gets generated from publisher.rb send_as, which doesn't accept :profile as one of the options. I don't think the publisher profile methods that are documented are actually implemented yet. Perhaps you should try set_profile_fbml in Facebooker::User? I don't actually see anything about profiles in any of the tutorials yet, and I haven't done it yet myself (I will be though). --simon > I tried moving over to the Facebooker publisher method. > > My publisher controller is: > class PublisherController < Facebooker::Rails::Publisher > def profile_update(user) > send_as :profile > recipients user > profile render(:partial => "profile", :assigns => { :user => > user }) > end > end > > My partial is _profile.erb: > Not working just yet. One can always hope! > > And my canvas controller calls: > PublisherController.deliver_profile_update(@fb_user) > > I get (in my error logs): > Facebooker::Rails::Publisher::UnknownBodyType (Unknown type to > publish): > I've got "send as :profile" in there - I'm not sure what I'm doing > wrong. -- http://simonwoodside.com -- http://simonwoodside.com From chris at cobaltedge.com Thu Mar 6 00:21:10 2008 From: chris at cobaltedge.com (Christopher Bailey) Date: Wed, 5 Mar 2008 21:21:10 -0800 Subject: [Facebooker-talk] facebook_url_rewriter not used in Publisher? Message-ID: <443c240c0803052121o712f5734j4e3ef283065a1f50@mail.gmail.com> As per my last email, I'm generating links to our app outside of Facebook. Sorry for the onslaught of emails on this. I do link generation in Publisher based code as well. What I'm finding is that the Facebooker UrlRewriter doesn't get used in Publisher. This makes sense if we assume that Publisher can be used outside of an HTTP request, and things like the UrlRewriter use the HTTP request. Yet, link_to, and url_for and such are there (probably sucked in via pulling in various other helpers and such). So, I wanted to find out the intent there. Link creation seems like something many folks would want to do when publishing into to a profile or to the feeds, etc. Maybe it's just not working for me, or I'm off on use or something? I should note that I've tried both with using things like link_to or url_for, as well as using named routes, and also from within my Publisher class' code, as well as the view template. -- Christopher Bailey Cobalt Edge LLC http://cobaltedge.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/facebooker-talk/attachments/20080305/0d9de813/attachment.html From chris at cobaltedge.com Thu Mar 6 00:23:09 2008 From: chris at cobaltedge.com (Christopher Bailey) Date: Wed, 5 Mar 2008 21:23:09 -0800 Subject: [Facebooker-talk] Profile Boxes In-Reply-To: <2E6C7374-744B-4C6F-A5C7-78EE9EA7A5A3@yahoo.com> References: <2E6C7374-744B-4C6F-A5C7-78EE9EA7A5A3@yahoo.com> Message-ID: <443c240c0803052123h1b609655w48e9e7786aad4d73@mail.gmail.com> Actually, send_as does accept :profile, see the threads in the last day or two, but the below code should work as long as you are on the latest Facebooker code. Is your Facebooker code the latest? On 3/5/08, S. Woodside wrote: > > Well, if you do a search in the facebooker code you'll see that only > gets generated from publisher.rb send_as, which doesn't > accept :profile as one of the options. I don't think the publisher > profile methods that are documented are actually implemented yet. > > Perhaps you should try set_profile_fbml in Facebooker::User? > > I don't actually see anything about profiles in any of the tutorials > yet, and I haven't done it yet myself (I will be though). > > --simon > > > I tried moving over to the Facebooker publisher method. > > > > My publisher controller is: > > class PublisherController < Facebooker::Rails::Publisher > > def profile_update(user) > > send_as :profile > > recipients user > > profile render(:partial => "profile", :assigns => { :user => > > user }) > > end > > end > > > > My partial is _profile.erb: > > Not working just yet. One can always hope! > > > > And my canvas controller calls: > > PublisherController.deliver_profile_update(@fb_user) > > > > I get (in my error logs): > > Facebooker::Rails::Publisher::UnknownBodyType (Unknown type to > > publish): > > I've got "send as :profile" in there - I'm not sure what I'm doing > > wrong. > > > > -- > http://simonwoodside.com > > > > > > -- > http://simonwoodside.com > > _______________________________________________ > 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/20080305/b7b23951/attachment.html From sbwoodside at yahoo.com Thu Mar 6 01:49:50 2008 From: sbwoodside at yahoo.com (S. Woodside) Date: Thu, 6 Mar 2008 01:49:50 -0500 Subject: [Facebooker-talk] Profile Boxes In-Reply-To: <443c240c0803052123h1b609655w48e9e7786aad4d73@mail.gmail.com> References: <2E6C7374-744B-4C6F-A5C7-78EE9EA7A5A3@yahoo.com> <443c240c0803052123h1b609655w48e9e7786aad4d73@mail.gmail.com> Message-ID: Damn, I thought that ./script/plugins update would automatically go out to facebooker's SVN and pull the latest, but I guess it doesn't. I switched to having vendor/plugins/facebooker being pulled directly via my own svn commands, and now I see that I was indeed out of date. The suck! Now I've got to redo my patches as well, bummer. --simon -- http://simonwoodside.com On Mar 6, 2008, at 12:23 AM, Christopher Bailey wrote: > Actually, send_as does accept :profile, see the threads in the last > day or two, but the below code should work as long as you are on > the latest Facebooker code. Is your Facebooker code the latest? > > On 3/5/08, S. Woodside wrote: Well, if you > do a search in the facebooker code you'll see that only > gets generated from publisher.rb send_as, which doesn't > accept :profile as one of the options. I don't think the publisher > profile methods that are documented are actually implemented yet. > > Perhaps you should try set_profile_fbml in Facebooker::User? > > I don't actually see anything about profiles in any of the tutorials > yet, and I haven't done it yet myself (I will be though). > > --simon > > > I tried moving over to the Facebooker publisher method. > > > > My publisher controller is: > > class PublisherController < Facebooker::Rails::Publisher > > def profile_update(user) > > send_as :profile > > recipients user > > profile render(:partial => "profile", :assigns => { :user => > > user }) > > end > > end > > > > My partial is _profile.erb: > > Not working just yet. One can always hope! > > > > And my canvas controller calls: > > PublisherController.deliver_profile_update(@fb_user) > > > > I get (in my error logs): > > Facebooker::Rails::Publisher::UnknownBodyType (Unknown type to > > publish): > > I've got "send as :profile" in there - I'm not sure what I'm doing > > wrong. > > > > -- > http://simonwoodside.com > > > > > > -- > http://simonwoodside.com > > _______________________________________________ > Facebooker-talk mailing list > Facebooker-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/facebooker-talk > > > > -- > Christopher Bailey > Cobalt Edge LLC > http://cobaltedge.com From jbresnik at gmail.com Thu Mar 6 05:05:41 2008 From: jbresnik at gmail.com (John Bresnik) Date: Thu, 6 Mar 2008 02:05:41 -0800 Subject: [Facebooker-talk] Getting at the FB response XML in Facebooker Message-ID: <3b8cec990803060205g829cd8t4247ce36159c7ab9@mail.gmail.com> I'm working with Matt [rfacebook] on a 'Migration to Facebooker' tag that essentially sets the stage [with backward compatibility] for a low-risk transition to Facebooker but had a quick question - doesn't look like it possible to get at the raw XML from Session/Service/etc - is that a correct or perhaps I missed something? We don't intend to recreate the Facepricot object or anything but would like to provide the raw XML for those apps that have had to use the XML directly [in certain cases].. Just curious. Thanks in advance.. From shanev at gmail.com Thu Mar 6 05:30:40 2008 From: shanev at gmail.com (Shane Vitarana) Date: Thu, 6 Mar 2008 02:30:40 -0800 Subject: [Facebooker-talk] patches on the rubyforge tracker In-Reply-To: <6ADCC99E-E6AE-4FE3-AB42-95B9DD773C7F@yahoo.com> References: <6ADCC99E-E6AE-4FE3-AB42-95B9DD773C7F@yahoo.com> Message-ID: <4ab757a40803060230s2bef9d2fw6286fb1a5f5dd379@mail.gmail.com> Simon- You're close. Just include tests, and put it in the "Patch" section of the tracker instead of "Bugs." Thanks! Shane On Wed, Mar 5, 2008 at 8:38 PM, S. Woodside wrote: > Hi I just made some changes / additions for myself in facebooker and > posted the patches on rubyforge, e.g.: > > https://rubyforge.org/tracker/index.php? > func=detail&aid=18639&group_id=4187&atid=16130 > > (adds support for fb:dialog FBML tag) > > Is this the right way to do it? > > --simon > > -- > http://simonwoodside.com > > _______________________________________________ > Facebooker-talk mailing list > Facebooker-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/facebooker-talk > -- http://shanesbrain.net | http://crimsonjet.com | http://myfitbuddy.com From mmangino at elevatedrails.com Thu Mar 6 08:55:59 2008 From: mmangino at elevatedrails.com (Mike Mangino) Date: Thu, 6 Mar 2008 07:55:59 -0600 Subject: [Facebooker-talk] facebook_url_rewriter not used in Publisher? In-Reply-To: <443c240c0803052121o712f5734j4e3ef283065a1f50@mail.gmail.com> References: <443c240c0803052121o712f5734j4e3ef283065a1f50@mail.gmail.com> Message-ID: <40512F3B-5EDA-4FA5-90A8-AE5B47187FFF@elevatedrails.com> This may be a rails 1.2 issue, as it works fine for me on rails 2.0. Can you share some code and some additional detail about what happens when you try to run it? Mike On Mar 5, 2008, at 11:21 PM, Christopher Bailey wrote: > As per my last email, I'm generating links to our app outside of > Facebook. Sorry for the onslaught of emails on this. I do link > generation in Publisher based code as well. What I'm finding is > that the Facebooker UrlRewriter doesn't get used in Publisher. This > makes sense if we assume that Publisher can be used outside of an > HTTP request, and things like the UrlRewriter use the HTTP request. > Yet, link_to, and url_for and such are there (probably sucked in via > pulling in various other helpers and such). So, I wanted to find > out the intent there. Link creation seems like something many folks > would want to do when publishing into to a profile or to the feeds, > etc. Maybe it's just not working for me, or I'm off on use or > something? > > > I should note that I've tried both with using things like link_to or > url_for, as well as using named routes, and also from within my > Publisher class' code, as well as the view template. > > -- > Christopher Bailey > Cobalt Edge LLC > http://cobaltedge.com > _______________________________________________ > Facebooker-talk mailing list > Facebooker-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/facebooker-talk -- Mike Mangino http://www.elevatedrails.com From mmangino at elevatedrails.com Thu Mar 6 08:57:39 2008 From: mmangino at elevatedrails.com (Mike Mangino) Date: Thu, 6 Mar 2008 07:57:39 -0600 Subject: [Facebooker-talk] Getting at the FB response XML in Facebooker In-Reply-To: <3b8cec990803060205g829cd8t4247ce36159c7ab9@mail.gmail.com> References: <3b8cec990803060205g829cd8t4247ce36159c7ab9@mail.gmail.com> Message-ID: <8210B179-5885-4F05-A161-6BAB792EBC85@elevatedrails.com> The raw XML is received in parser.rb, you could definitely modify the Service#post method to store that aside somewhere. It probably won't be threadsafe, but it should work. Mike On Mar 6, 2008, at 4:05 AM, John Bresnik wrote: > I'm working with Matt [rfacebook] on a 'Migration to Facebooker' tag > that essentially sets the stage [with backward compatibility] for a > low-risk transition to Facebooker but had a quick question - doesn't > look like it possible to get at the raw XML from Session/Service/etc - > is that a correct or perhaps I missed something? We don't intend to > recreate the Facepricot object or anything but would like to provide > the raw XML for those apps that have had to use the XML directly [in > certain cases].. Just curious. > > Thanks in advance.. > _______________________________________________ > Facebooker-talk mailing list > Facebooker-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/facebooker-talk -- Mike Mangino http://www.elevatedrails.com From chris at cobaltedge.com Thu Mar 6 12:23:06 2008 From: chris at cobaltedge.com (Christopher Bailey) Date: Thu, 6 Mar 2008 09:23:06 -0800 Subject: [Facebooker-talk] facebook_url_rewriter not used in Publisher? In-Reply-To: <40512F3B-5EDA-4FA5-90A8-AE5B47187FFF@elevatedrails.com> References: <443c240c0803052121o712f5734j4e3ef283065a1f50@mail.gmail.com> <40512F3B-5EDA-4FA5-90A8-AE5B47187FFF@elevatedrails.com> Message-ID: <443c240c0803060923p29a8929es8e152f9e94876660@mail.gmail.com> Well, I suspected that :) Last night I started a spike on getting up to date on Rails. This is involved for us since we currently use Appable Plugins, and I need to convert to Desert in order to even move to Rails 1.2.4 or later, so I'm working on that. I've got rake, db, and unit tests working, now to get functionals and RSpec stuff going. Heh, then I can start updating Rails :) Ok, nobody cares about that, but that's where I am. As for the problem, it usually complains about missing "default_url_options". So, it actually finds link_to and url_for and such, but within the guts of all that, default_url_options comes up missing. I haven't had a chance to dig into that yet. On 3/6/08, Mike Mangino wrote: > > This may be a rails 1.2 issue, as it works fine for me on rails 2.0. > > Can you share some code and some additional detail about what happens > when you try to run it? > > Mike > > > On Mar 5, 2008, at 11:21 PM, Christopher Bailey wrote: > > > As per my last email, I'm generating links to our app outside of > > Facebook. Sorry for the onslaught of emails on this. I do link > > generation in Publisher based code as well. What I'm finding is > > that the Facebooker UrlRewriter doesn't get used in Publisher. This > > makes sense if we assume that Publisher can be used outside of an > > HTTP request, and things like the UrlRewriter use the HTTP request. > > Yet, link_to, and url_for and such are there (probably sucked in via > > pulling in various other helpers and such). So, I wanted to find > > out the intent there. Link creation seems like something many folks > > would want to do when publishing into to a profile or to the feeds, > > etc. Maybe it's just not working for me, or I'm off on use or > > something? > > > > > > I should note that I've tried both with using things like link_to or > > url_for, as well as using named routes, and also from within my > > Publisher class' code, as well as the view template. > > > > -- > > Christopher Bailey > > Cobalt Edge LLC > > http://cobaltedge.com > > > _______________________________________________ > > Facebooker-talk mailing list > > Facebooker-talk at rubyforge.org > > http://rubyforge.org/mailman/listinfo/facebooker-talk > > > -- > 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/20080306/ab7512da/attachment.html From mmangino at elevatedrails.com Thu Mar 6 12:27:44 2008 From: mmangino at elevatedrails.com (Mike Mangino) Date: Thu, 6 Mar 2008 11:27:44 -0600 Subject: [Facebooker-talk] facebook_url_rewriter not used in Publisher? In-Reply-To: <443c240c0803060923p29a8929es8e152f9e94876660@mail.gmail.com> References: <443c240c0803052121o712f5734j4e3ef283065a1f50@mail.gmail.com> <40512F3B-5EDA-4FA5-90A8-AE5B47187FFF@elevatedrails.com> <443c240c0803060923p29a8929es8e152f9e94876660@mail.gmail.com> Message-ID: You might try defining "default_url_options" in your publisher. It should take a single optional hash parameter and return a hash. Mike On Mar 6, 2008, at 11:23 AM, Christopher Bailey wrote: > Well, I suspected that :) Last night I started a spike on getting > up to date on Rails. This is involved for us since we currently use > Appable Plugins, and I need to convert to Desert in order to even > move to Rails 1.2.4 or later, so I'm working on that. I've got > rake, db, and unit tests working, now to get functionals and RSpec > stuff going. Heh, then I can start updating Rails :) Ok, nobody > cares about that, but that's where I am. > > > As for the problem, it usually complains about missing > "default_url_options". So, it actually finds link_to and url_for > and such, but within the guts of all that, default_url_options comes > up missing. I haven't had a chance to dig into that yet. > > On 3/6/08, Mike Mangino wrote: This may > be a rails 1.2 issue, as it works fine for me on rails 2.0. > > Can you share some code and some additional detail about what happens > when you try to run it? > > Mike > > > On Mar 5, 2008, at 11:21 PM, Christopher Bailey wrote: > > > As per my last email, I'm generating links to our app outside of > > Facebook. Sorry for the onslaught of emails on this. I do link > > generation in Publisher based code as well. What I'm finding is > > that the Facebooker UrlRewriter doesn't get used in Publisher. This > > makes sense if we assume that Publisher can be used outside of an > > HTTP request, and things like the UrlRewriter use the HTTP request. > > Yet, link_to, and url_for and such are there (probably sucked in via > > pulling in various other helpers and such). So, I wanted to find > > out the intent there. Link creation seems like something many folks > > would want to do when publishing into to a profile or to the feeds, > > etc. Maybe it's just not working for me, or I'm off on use or > > something? > > > > > > I should note that I've tried both with using things like link_to or > > url_for, as well as using named routes, and also from within my > > Publisher class' code, as well as the view template. > > > > -- > > Christopher Bailey > > Cobalt Edge LLC > > http://cobaltedge.com > > > _______________________________________________ > > Facebooker-talk mailing list > > Facebooker-talk at rubyforge.org > > http://rubyforge.org/mailman/listinfo/facebooker-talk > > > -- > Mike Mangino > http://www.elevatedrails.com > > > > > > -- > Christopher Bailey > Cobalt Edge LLC > http://cobaltedge.com -- Mike Mangino http://www.elevatedrails.com From uvmarko at gmail.com Mon Mar 10 11:19:20 2008 From: uvmarko at gmail.com (yuval markovich) Date: Mon, 10 Mar 2008 17:19:20 +0200 Subject: [Facebooker-talk] Ajax and facebooker Message-ID: <644d91f20803100819m4e8d2155x3cbf2354414ddc1f@mail.gmail.com> Hi there, I've been trying to establish a session call from an a ajax call to retrieve a user's friends. How do I set a session up from Ajax? I have the session key ,secret ,api_key, user_id and all but how do I get a session user? Thanks, Yuval From jonathan.otto at gmail.com Mon Mar 10 14:45:00 2008 From: jonathan.otto at gmail.com (Jonathan Otto) Date: Mon, 10 Mar 2008 13:45:00 -0500 Subject: [Facebooker-talk] facebooker is rewriting URLs even off of facebook canvas Message-ID: 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? From chris at cobaltedge.com Mon Mar 10 14:50:58 2008 From: chris at cobaltedge.com (Christopher Bailey) Date: Mon, 10 Mar 2008 11:50:58 -0700 Subject: [Facebooker-talk] facebooker is rewriting URLs even off of facebook canvas In-Reply-To: References: Message-ID: <443c240c0803101150x17c896b8tac6d389963f43911@mail.gmail.com> 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 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 From jonathan.otto at gmail.com Mon Mar 10 14:52:33 2008 From: jonathan.otto at gmail.com (Jonathan Otto) Date: Mon, 10 Mar 2008 13:52:33 -0500 Subject: [Facebooker-talk] facebooker is rewriting URLs even off of facebook canvas In-Reply-To: <443c240c0803101150x17c896b8tac6d389963f43911@mail.gmail.com> References: <443c240c0803101150x17c896b8tac6d389963f43911@mail.gmail.com> Message-ID: was not using canvs false. i am on 2.0.2 On Mon, Mar 10, 2008 at 1:50 PM, Christopher Bailey 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 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 From chris at cobaltedge.com Mon Mar 10 15:15:42 2008 From: chris at cobaltedge.com (Christopher Bailey) Date: Mon, 10 Mar 2008 12:15:42 -0700 Subject: [Facebooker-talk] facebooker is rewriting URLs even off of facebook canvas In-Reply-To: References: <443c240c0803101150x17c896b8tac6d389963f43911@mail.gmail.com> Message-ID: <443c240c0803101215g4c512786xd81b7ebdd09c61b9@mail.gmail.com> 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 wrote: > > was not using canvs false. i am on 2.0.2 > > > On Mon, Mar 10, 2008 at 1:50 PM, Christopher Bailey > 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 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 From chris at cobaltedge.com Mon Mar 10 15:59:52 2008 From: chris at cobaltedge.com (Christopher Bailey) Date: Mon, 10 Mar 2008 12:59:52 -0700 Subject: [Facebooker-talk] facebooker is rewriting URLs even off of facebook canvas In-Reply-To: References: <443c240c0803101150x17c896b8tac6d389963f43911@mail.gmail.com> <443c240c0803101215g4c512786xd81b7ebdd09c61b9@mail.gmail.com> Message-ID: <443c240c0803101259y2ab078a1lf95bef2ce3717192@mail.gmail.com> 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 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 > > 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 wrote: > > > was not using canvs false. i am on 2.0.2 > > > > > > > > > On Mon, Mar 10, 2008 at 1:50 PM, Christopher Bailey > > > 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 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 From jonathan.otto at gmail.com Mon Mar 10 16:02:41 2008 From: jonathan.otto at gmail.com (Jonathan Otto) Date: Mon, 10 Mar 2008 15:02:41 -0500 Subject: [Facebooker-talk] facebooker is rewriting URLs even off of facebook canvas In-Reply-To: <443c240c0803101259y2ab078a1lf95bef2ce3717192@mail.gmail.com> References: <443c240c0803101150x17c896b8tac6d389963f43911@mail.gmail.com> <443c240c0803101215g4c512786xd81b7ebdd09c61b9@mail.gmail.com> <443c240c0803101259y2ab078a1lf95bef2ce3717192@mail.gmail.com> Message-ID: 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 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 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 > > > > 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 wrote: > > > > was not using canvs false. i am on 2.0.2 > > > > > > > > > > > > On Mon, Mar 10, 2008 at 1:50 PM, Christopher Bailey > > > > 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 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 From chris at cobaltedge.com Mon Mar 10 16:11:57 2008 From: chris at cobaltedge.com (Christopher Bailey) Date: Mon, 10 Mar 2008 13:11:57 -0700 Subject: [Facebooker-talk] facebooker is rewriting URLs even off of facebook canvas In-Reply-To: References: <443c240c0803101150x17c896b8tac6d389963f43911@mail.gmail.com> <443c240c0803101215g4c512786xd81b7ebdd09c61b9@mail.gmail.com> <443c240c0803101259y2ab078a1lf95bef2ce3717192@mail.gmail.com> Message-ID: <443c240c0803101311j5a6e2342h4673a81aed8d2c35@mail.gmail.com> 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 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 > > 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 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 > > > > > > 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 wrote: > > > > > was not using canvs false. i am on 2.0.2 > > > > > > > > > > > > > > > On Mon, Mar 10, 2008 at 1:50 PM, Christopher Bailey > > > > > 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 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 From jonathan.otto at gmail.com Mon Mar 10 16:25:36 2008 From: jonathan.otto at gmail.com (Jonathan Otto) Date: Mon, 10 Mar 2008 15:25:36 -0500 Subject: [Facebooker-talk] facebooker is rewriting URLs even off of facebook canvas In-Reply-To: <443c240c0803101311j5a6e2342h4673a81aed8d2c35@mail.gmail.com> References: <443c240c0803101150x17c896b8tac6d389963f43911@mail.gmail.com> <443c240c0803101215g4c512786xd81b7ebdd09c61b9@mail.gmail.com> <443c240c0803101259y2ab078a1lf95bef2ce3717192@mail.gmail.com> <443c240c0803101311j5a6e2342h4673a81aed8d2c35@mail.gmail.com> Message-ID: 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 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 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 > > > > 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 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 > > > > > > > > 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 wrote: > > > > > > was not using canvs false. i am on 2.0.2 > > > > > > > > > > > > > > > > > > On Mon, Mar 10, 2008 at 1:50 PM, Christopher Bailey > > > > > > 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 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 From chris at cobaltedge.com Mon Mar 10 17:02:44 2008 From: chris at cobaltedge.com (Christopher Bailey) Date: Mon, 10 Mar 2008 14:02:44 -0700 Subject: [Facebooker-talk] facebooker is rewriting URLs even off of facebook canvas In-Reply-To: References: <443c240c0803101150x17c896b8tac6d389963f43911@mail.gmail.com> <443c240c0803101215g4c512786xd81b7ebdd09c61b9@mail.gmail.com> <443c240c0803101259y2ab078a1lf95bef2ce3717192@mail.gmail.com> <443c240c0803101311j5a6e2342h4673a81aed8d2c35@mail.gmail.com> Message-ID: <443c240c0803101402u23192e7ei9bdc2d6db841b661@mail.gmail.com> 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 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 > > 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 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 > > > > > > 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 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 > > > > > > > > > > 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 wrote: > > > > > > > was not using canvs false. i am on 2.0.2 > > > > > > > > > > > > > > > > > > > > > On Mon, Mar 10, 2008 at 1:50 PM, Christopher Bailey > > > > > > > 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 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 From jonathan.otto at gmail.com Mon Mar 10 17:46:50 2008 From: jonathan.otto at gmail.com (Jonathan Otto) Date: Mon, 10 Mar 2008 16:46:50 -0500 Subject: [Facebooker-talk] facebooker is rewriting URLs even off of facebook canvas In-Reply-To: <443c240c0803101402u23192e7ei9bdc2d6db841b661@mail.gmail.com> References: <443c240c0803101150x17c896b8tac6d389963f43911@mail.gmail.com> <443c240c0803101215g4c512786xd81b7ebdd09c61b9@mail.gmail.com> <443c240c0803101259y2ab078a1lf95bef2ce3717192@mail.gmail.com> <443c240c0803101311j5a6e2342h4673a81aed8d2c35@mail.gmail.com> <443c240c0803101402u23192e7ei9bdc2d6db841b661@mail.gmail.com> Message-ID: 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 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 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 > > > > 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 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 > > > > > > > > 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 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 > > > > > > > > > > > > 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 wrote: > > > > > > > > was not using canvs false. i am on 2.0.2 > > > > > > > > > > > > > > > > > > > > > > > > On Mon, Mar 10, 2008 at 1:50 PM, Christopher Bailey > > > > > > > > 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 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 From chris at cobaltedge.com Mon Mar 10 17:59:40 2008 From: chris at cobaltedge.com (Christopher Bailey) Date: Mon, 10 Mar 2008 14:59:40 -0700 Subject: [Facebooker-talk] facebooker is rewriting URLs even off of facebook canvas In-Reply-To: References: <443c240c0803101215g4c512786xd81b7ebdd09c61b9@mail.gmail.com> <443c240c0803101259y2ab078a1lf95bef2ce3717192@mail.gmail.com> <443c240c0803101311j5a6e2342h4673a81aed8d2c35@mail.gmail.com> <443c240c0803101402u23192e7ei9bdc2d6db841b661@mail.gmail.com> Message-ID: <443c240c0803101459n177f01d7mf518f5655186a740@mail.gmail.com> 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 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 > > 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 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 > > > > > > 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 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 > > > > > > > > > > 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 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 > > > > > > > > > > > > > > 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 wrote: > > > > > > > > > was not using canvs false. i am on 2.0.2 > > > > > > > > > > > > > > > > > > > > > > > > > > > On Mon, Mar 10, 2008 at 1:50 PM, Christopher Bailey > > > > > > > > > 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 > 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 From mmangino at elevatedrails.com Mon Mar 10 18:32:37 2008 From: mmangino at elevatedrails.com (Mike Mangino) Date: Mon, 10 Mar 2008 17:32:37 -0500 Subject: [Facebooker-talk] facebooker is rewriting URLs even off of facebook canvas In-Reply-To: References: <443c240c0803101150x17c896b8tac6d389963f43911@mail.gmail.com> <443c240c0803101215g4c512786xd81b7ebdd09c61b9@mail.gmail.com> <443c240c0803101259y2ab078a1lf95bef2ce3717192@mail.gmail.com> <443c240c0803101311j5a6e2342h4673a81aed8d2c35@mail.gmail.com> <443c240c0803101402u23192e7ei9bdc2d6db841b661@mail.gmail.com> Message-ID: 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 From jonathan.otto at gmail.com Mon Mar 10 18:49:24 2008 From: jonathan.otto at gmail.com (Jonathan Otto) Date: Mon, 10 Mar 2008 17:49:24 -0500 Subject: [Facebooker-talk] facebooker is rewriting URLs even off of facebook canvas In-Reply-To: References: <443c240c0803101215g4c512786xd81b7ebdd09c61b9@mail.gmail.com> <443c240c0803101259y2ab078a1lf95bef2ce3717192@mail.gmail.com> <443c240c0803101311j5a6e2342h4673a81aed8d2c35@mail.gmail.com> <443c240c0803101402u23192e7ei9bdc2d6db841b661@mail.gmail.com> Message-ID: 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 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 > > > > From chris at cobaltedge.com Mon Mar 10 19:06:01 2008 From: chris at cobaltedge.com (Christopher Bailey) Date: Mon, 10 Mar 2008 16:06:01 -0700 Subject: [Facebooker-talk] facebooker is rewriting URLs even off of facebook canvas In-Reply-To: References: <443c240c0803101259y2ab078a1lf95bef2ce3717192@mail.gmail.com> <443c240c0803101311j5a6e2342h4673a81aed8d2c35@mail.gmail.com> <443c240c0803101402u23192e7ei9bdc2d6db841b661@mail.gmail.com> Message-ID: <443c240c0803101606x1e33ce75i64d609f1c6da93@mail.gmail.com> 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 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 > 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 From jonathan.otto at gmail.com Tue Mar 11 12:15:36 2008 From: jonathan.otto at gmail.com (Jonathan Otto) Date: Tue, 11 Mar 2008 11:15:36 -0500 Subject: [Facebooker-talk] detecting if in the FB canvas Message-ID: I have been checking the params for params[:fb_sig] to detect if the client is in the Facebook canvas, but those don't work at the beginning of a controller when you're calling before_filters. I have a require_login in the before_filter, but I want to skip it if the user is from Facebook. So are there any other ways to check that the client is coming from the canvas? From wil at 3cglabs.com Tue Mar 11 15:03:16 2008 From: wil at 3cglabs.com (Wilhelm Chung) Date: Tue, 11 Mar 2008 14:03:16 -0500 Subject: [Facebooker-talk] Facebooker-talk Digest, Vol 5, Issue 12 In-Reply-To: References: Message-ID: <4cdd0d160803111203n18cd62b7u81dc3e60d789868c@mail.gmail.com> Hi all, I wanted to test requests from internal facebook apps, so I've been mimicking FBML requests from facebook in my tests using the following: def test_can_facebook_internal_app_login fb_login_as :facebooker num_of_members = Member.count facebook_request :get, :home assert_response :success assert_equal num_of_members, Member.count assert_session_user_data_exists end The code is fairly simple: module Facebooker module Rails module TestHelpers # user facebook id for facebook_request def set_user_facebook_id(fb_id) @fb_id = fb_id end # makes a request as if it was from facebook. Need to set_user_facebook_id() first # so it knows whom to send the request as. def facebook_request(http_verb, action, params = { }) fb_params = { "fb_sig_time" => Time.now.to_f, "fb_sig_locale" => "en_US", "fb_sig_session_key" => "d82ebe8648254d4cef7d993a-1953401", "fb_sig_position_fix" => "1", "fb_sig_in_canvas" => "1", "fb_sig_request_method" => http_verb.to_s.upcase, "fb_sig_expires" => "0", "fb_sig_added" => "1", "fb_sig_api_key" => Facebooker::Session.api_key, "fb_sig_profile_update_time" => "1203267404", "fb_sig_user" => @fb_id } fb_params.merge!("fb_sig" => signature_for(fb_params)) @request.accept = "text/fbml" send(http_verb, action, params.merge(fb_params)) @request.accept = "text/html" end private # TODO this is copied from session.rb MUST REFACTOR def signature_for(params) facebook_sig_params = params.inject({}) do |collection, pair| collection[pair.first.sub(/^fb_sig_/, '')] = pair.last if pair.first[0,7] == 'fb_sig_' collection end raw_string = facebook_sig_params.map{ |*args| args.join('=') }.sort.join actual_sig = Digest::MD5.hexdigest([raw_string, Facebooker::Session.secret_key].join) Digest::MD5.hexdigest([raw_string, Facebooker::Session.secret_key].join) end end end end I had wanted to submit the code as a patch, but, there are two or three glaring flaws with the code: 1) signature_for is duplicated here, because it's a private/protected method in Facebooker::Session. Would it be a bad idea to call send(:singature_for) to call the protected method? Or is there another way around it? 2) One has to call set_user_facebook_id in the setup of your tests in order for facebook_request to work. 3) fb_sig_session_key expires over time, and I have to get another one from a real facebook request. This is tedious. Is there a way to generate a session key, or request a new one from facebook while you're in the unit tests? I was wondering if anyone had good opinions or solutions to this, so that they can be generic enough and clean enough for others to use. Thanks. From wil at 3cglabs.com Tue Mar 11 15:07:51 2008 From: wil at 3cglabs.com (Wilhelm Chung) Date: Tue, 11 Mar 2008 14:07:51 -0500 Subject: [Facebooker-talk] Facebook_request in unit tests Message-ID: <4cdd0d160803111207t5a2b207dxb1db8cdfb0aab871@mail.gmail.com> Apologies for not chaning the subject line. :( Hi all, I wanted to test requests from internal facebook apps, so I've been mimicking FBML requests from facebook in my tests using the following: def test_can_facebook_internal_app_login fb_login_as :facebooker num_of_members = Member.count facebook_request :get, :home assert_response :success assert_equal num_of_members, Member.count assert_session_user_data_exists end The code is fairly simple: module Facebooker module Rails module TestHelpers # user facebook id for facebook_request def set_user_facebook_id(fb_id) @fb_id = fb_id end # makes a request as if it was from facebook. Need to set_user_facebook_id() first # so it knows whom to send the request as. def facebook_request(http_verb, action, params = { }) fb_params = { "fb_sig_time" => Time.now.to_f, "fb_sig_locale" => "en_US", "fb_sig_session_key" => "d82ebe8648254d4cef7d993a-1953401", "fb_sig_position_fix" => "1", "fb_sig_in_canvas" => "1", "fb_sig_request_method" => http_verb.to_s.upcase, "fb_sig_expires" => "0", "fb_sig_added" => "1", "fb_sig_api_key" => Facebooker::Session.api_key, "fb_sig_profile_update_time" => "1203267404", "fb_sig_user" => @fb_id } fb_params.merge!("fb_sig" => signature_for(fb_params)) @request.accept = "text/fbml" send(http_verb, action, params.merge(fb_params)) @request.accept = "text/html" end private # TODO this is copied from session.rb MUST REFACTOR def signature_for(params) facebook_sig_params = params.inject({}) do |collection, pair| collection[pair.first.sub(/^fb_sig_/, '')] = pair.last if pair.first[0,7] == 'fb_sig_' collection end raw_string = facebook_sig_params.map{ |*args| args.join('=') }.sort.join actual_sig = Digest::MD5.hexdigest([raw_string, Facebooker::Session.secret_key].join) Digest::MD5.hexdigest([raw_string, Facebooker::Session.secret_key].join) end end end end I had wanted to submit the code as a patch, but, there are two or three glaring flaws with the code: 1) signature_for is duplicated here, because it's a private/protected method in Facebooker::Session. Would it be a bad idea to call send(:singature_for) to call the protected method? Or is there another way around it? 2) One has to call set_user_facebook_id in the setup of your tests in order for facebook_request to work. 3) fb_sig_session_key expires over time, and I have to get another one from a real facebook request. This is tedious. Is there a way to generate a session key, or request a new one from facebook while you're in the unit tests? I was wondering if anyone had good opinions or solutions to this, so that they can be generic enough and clean enough for others to use. Thanks. From phylae at gmail.com Tue Mar 11 16:59:20 2008 From: phylae at gmail.com (Paul Cortens) Date: Tue, 11 Mar 2008 13:59:20 -0700 Subject: [Facebooker-talk] trouble with MyPublisher.deliver_story Message-ID: hi, I can't seem to be able to delivery stories! I have this in my controller MyPublisher.deliver_story(@current_facebook_user.friends.first, @current_facebook_user, @object.id) This is in models/my_publisher.rb # story is published to the story of the to user def story(to, f, object_id) send_as :story recipients to title "An object?" body "#{fb_name(f)} is sending you a message about #{link_to('this object', show_object_path(object_id))}." end No exceptions are raise. However, the story never shows up. What am I doing wrong? Thanks, Paul -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/facebooker-talk/attachments/20080311/6141343e/attachment.html From phylae at gmail.com Tue Mar 11 17:01:54 2008 From: phylae at gmail.com (Paul Cortens) Date: Tue, 11 Mar 2008 14:01:54 -0700 Subject: [Facebooker-talk] trouble with MyPublisher.deliver_story In-Reply-To: References: Message-ID: I should also note that sending a notification did work. Paul On 3/11/08, Paul Cortens wrote: > > hi, > > I can't seem to be able to delivery stories! > > I have this in my controller > MyPublisher.deliver_story(@current_facebook_user.friends.first, > @current_facebook_user, @object.id) > > > This is in models/my_publisher.rb > > # story is published to the story of the to user > def story(to, f, object_id) > send_as :story > recipients to > title "An object?" > body "#{fb_name(f)} is sending you a message about #{link_to('this > object', show_object_path(object_id))}." > end > > > No exceptions are raise. However, the story never shows up. > > What am I doing wrong? > > Thanks, > Paul > -- Ezk. 36 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/facebooker-talk/attachments/20080311/85006161/attachment-0001.html From phylae at gmail.com Tue Mar 11 17:51:58 2008 From: phylae at gmail.com (Paul Cortens) Date: Tue, 11 Mar 2008 14:51:58 -0700 Subject: [Facebooker-talk] trouble with MyPublisher.deliver_story In-Reply-To: References: Message-ID: Nevermind. This page cleared things up for me http://wiki.developers.facebook.com/index.php/PublishActionOfUser_vs._PublishStoryToUser I was confusing actions and stories. Sorry to be a bother. Paul On 3/11/08, Paul Cortens wrote: > > hi, > > I can't seem to be able to delivery stories! > > I have this in my controller > MyPublisher.deliver_story(@current_facebook_user.friends.first, > @current_facebook_user, @object.id) > > > This is in models/my_publisher.rb > > # story is published to the story of the to user > def story(to, f, object_id) > send_as :story > recipients to > title "An object?" > body "#{fb_name(f)} is sending you a message about #{link_to('this > object', show_object_path(object_id))}." > end > > > No exceptions are raise. However, the story never shows up. > > What am I doing wrong? > > Thanks, > Paul > -- Ezk. 36 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/facebooker-talk/attachments/20080311/16ab085f/attachment.html From wil at 3cglabs.com Tue Mar 11 18:01:59 2008 From: wil at 3cglabs.com (Wilhelm Chung) Date: Tue, 11 Mar 2008 17:01:59 -0500 Subject: [Facebooker-talk] How to get a facebook session for desktop applications (or unit tests?) Message-ID: <4cdd0d160803111501o765a0091tb6e62c0e6adb200e@mail.gmail.com> Normally, in a rails app, all one would have to do is call set_facebook_session, or the ensure_* filters to get a valid session. I've been looking through the sessions code to figure out how to get a valid session for desktop applications (or unit tests)--basically outside of rails controller. As far as I can ascertain, you should just be able to do this: require 'facebooker' sess = Facebooker::Session.create sess.secure! Since secure! calls auth_token to get authentication token on its own if it hadn't already. But instead this throws a Facebooker::Session::MissingOrInvalidParameter: => # >> sess.secure! Facebooker::Session::MissingOrInvalidParameter: Invalid parameter from /home/wil/proj/3cgworkspace/mobtropolis/vendor/plugins/facebooker/lib/facebooker/parser.rb:386:in `process' from /home/wil/proj/3cgworkspace/mobtropolis/vendor/plugins/facebooker/lib/facebooker/parser.rb:15:in `parse' from /home/wil/proj/3cgworkspace/mobtropolis/vendor/plugins/facebooker/lib/facebooker/service.rb:13:in `post' from /home/wil/proj/3cgworkspace/mobtropolis/vendor/plugins/facebooker/lib/facebooker/session.rb:398:in `post' from /home/wil/proj/3cgworkspace/mobtropolis/vendor/plugins/facebooker/lib/facebooker/session.rb:137:in `secure!' from (irb):14 I think I'm missing something fundamental. I've looked through the fb developer docs and the facebooker code, but I"m coming up short. Can anyone set me straight? Thanks. Wilhelm -- http://webjazz.blogspot.com http://www.mobtropolis.com http://www.3cglabs.com From sbwoodside at yahoo.com Tue Mar 11 20:42:14 2008 From: sbwoodside at yahoo.com (S. Woodside) Date: Tue, 11 Mar 2008 20:42:14 -0400 Subject: [Facebooker-talk] a way to restrict who can install your app, for private testing Message-ID: <6D5AB4DD-16AC-44AD-8233-DF7C58F86034@yahoo.com> This is something I just cooked up to allow me to restrict temporarily who can access my app, based on an array of UIDs. It's messy but works. Put at the top of your controller, at the end of your filters. # This filter is only until we open everything up before_filter do |c| acceptable_uids = ['594180515', '122612996'] unless acceptable_uids.include? c.get_facebook_session.user.uid RAILS_DEFAULT_LOGGER.debug "my UID = " + c.get_facebook_session.user.uid + " but acceptable_uids = " + acceptable_uids.to_s raise RuntimeError("This isn't going to work") end end def get_facebook_session @facebook_session end If it deems the user unacceptable, it actually fails with: NoMethodError (undefined method `RuntimeError' for FacebookController:Class): I don't know why, I think it's got something to do with using a block or something. However, it still does what it's supposed to do, which is prevent anyone not on the list from seeing your app. --simon -- http://simonwoodside.com From sbwoodside at yahoo.com Tue Mar 11 20:59:11 2008 From: sbwoodside at yahoo.com (S. Woodside) Date: Tue, 11 Mar 2008 20:59:11 -0400 Subject: [Facebooker-talk] patches on the rubyforge tracker In-Reply-To: <4ab757a40803060230s2bef9d2fw6286fb1a5f5dd379@mail.gmail.com> References: <6ADCC99E-E6AE-4FE3-AB42-95B9DD773C7F@yahoo.com> <4ab757a40803060230s2bef9d2fw6286fb1a5f5dd379@mail.gmail.com> Message-ID: <1ECDDB86-BF96-4A1B-A03B-BA32C0CC990B@yahoo.com> I know you're all gonna hate me (and think I'm dumb) for saying this, but I don't really have time to write tests, in fact I don't even know how yet. I moved it to patches but I probably won't get around to tests for quite a while, since it "works for me"... http://rubyforge.org/tracker/index.php? func=detail&aid=18772&group_id=4187&atid=16132 --simon -- http://simonwoodside.com On Mar 6, 2008, at 5:30 AM, Shane Vitarana wrote: > Simon- > > You're close. Just include tests, and put it in the "Patch" section > of the tracker instead of "Bugs." > > Thanks! > Shane > > On Wed, Mar 5, 2008 at 8:38 PM, S. Woodside > wrote: >> Hi I just made some changes / additions for myself in facebooker and >> posted the patches on rubyforge, e.g.: >> >> https://rubyforge.org/tracker/index.php? >> func=detail&aid=18639&group_id=4187&atid=16130 >> >> (adds support for fb:dialog FBML tag) >> >> Is this the right way to do it? >> >> --simon >> >> -- >> http://simonwoodside.com >> >> _______________________________________________ >> Facebooker-talk mailing list >> Facebooker-talk at rubyforge.org >> http://rubyforge.org/mailman/listinfo/facebooker-talk >> > > > > -- > http://shanesbrain.net | http://crimsonjet.com | http://myfitbuddy.com From chris at cobaltedge.com Tue Mar 11 23:13:20 2008 From: chris at cobaltedge.com (Christopher Bailey) Date: Tue, 11 Mar 2008 20:13:20 -0700 Subject: [Facebooker-talk] a way to restrict who can install your app, for private testing In-Reply-To: <6D5AB4DD-16AC-44AD-8233-DF7C58F86034@yahoo.com> References: <6D5AB4DD-16AC-44AD-8233-DF7C58F86034@yahoo.com> Message-ID: <443c240c0803112013s42f574e0vcc240185bc7a70e3@mail.gmail.com> An alternative is simply to make your app not publicly installable, and to designate certain people as "developers" of the app. You can do this on the app's settings page on Facebook. That way you don't have to put code in your app that you have to then take back out, etc. I also tend to leverage the "test" users you can set up. So, while I'm doing my own testing (where only I am looking at the app, or a small set of us), I set up some test users add them as friends, have them add the app, etc., then go mark them as actual test user's in Facebook, etc. I designate these as "developers" of the app, so they have access. On 3/11/08, S. Woodside wrote: > > This is something I just cooked up to allow me to restrict > temporarily who can access my app, based on an array of UIDs. It's > messy but works. Put at the top of your controller, at the end of > your filters. > > # This filter is only until we open everything up > before_filter do |c| > acceptable_uids = ['594180515', '122612996'] > unless acceptable_uids.include? c.get_facebook_session.user.uid > RAILS_DEFAULT_LOGGER.debug "my UID = " + > c.get_facebook_session.user.uid + " but acceptable_uids = " + > acceptable_uids.to_s > raise RuntimeError("This isn't going to work") > end > end > def get_facebook_session > @facebook_session > end > > > If it deems the user unacceptable, it actually fails with: > NoMethodError (undefined method `RuntimeError' for > FacebookController:Class): > > I don't know why, I think it's got something to do with using a block > or something. However, it still does what it's supposed to do, which > is prevent anyone not on the list from seeing your app. > > --simon > > > -- > http://simonwoodside.com > > _______________________________________________ > 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/20080311/6196bab0/attachment.html From mmangino at elevatedrails.com Wed Mar 12 15:09:02 2008 From: mmangino at elevatedrails.com (Mike Mangino) Date: Wed, 12 Mar 2008 14:09:02 -0500 Subject: [Facebooker-talk] Developing Facebook Platform Applications with Rails Message-ID: I was hoping to announce this a month ago, but some legal wrangling took longer than expected. Developing Facebook Platform Applications with Rails is now available in Beta at http://www.pragprog.com/titles/mmfacer It walks you through creating a Facebook application with Facebooker, all the way from setup to handling large number of users. Thank all of you for asking questions on this list. I did my best to answer all of them in the book. Expect to see more chapters shortly, as information on FBJS, profile updating and performance are added. Mike -- Mike Mangino http://www.elevatedrails.com From jbresnik at gmail.com Wed Mar 12 16:15:15 2008 From: jbresnik at gmail.com (John Bresnik) Date: Wed, 12 Mar 2008 13:15:15 -0700 Subject: [Facebooker-talk] Developing Facebook Platform Applications with Rails In-Reply-To: References: Message-ID: <3b8cec990803121315l2e7c57f2uefedf889fbcf4295@mail.gmail.com> Alright.. very nice. On Wed, Mar 12, 2008 at 12:09 PM, Mike Mangino wrote: > I was hoping to announce this a month ago, but some legal wrangling > took longer than expected. > > Developing Facebook Platform Applications with Rails is now available > in Beta at http://www.pragprog.com/titles/mmfacer > > It walks you through creating a Facebook application with Facebooker, > all the way from setup to handling large number of users. > > Thank all of you for asking questions on this list. I did my best to > answer all of them in the book. Expect to see more chapters shortly, > as information on FBJS, profile updating and performance are added. > > Mike > -- > Mike Mangino > http://www.elevatedrails.com > > > > _______________________________________________ > Facebooker-talk mailing list > Facebooker-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/facebooker-talk > From jnylund at yahoo.com Wed Mar 12 16:29:03 2008 From: jnylund at yahoo.com (Joel Nylund) Date: Wed, 12 Mar 2008 16:29:03 -0400 Subject: [Facebooker-talk] Developing Facebook Platform Applications with Rails In-Reply-To: References: Message-ID: <6DB86F87-AD36-4E65-BD19-FC34822BAE36@yahoo.com> Haven't had time to read it all, but from a quick browse it looks good so far! Thanks Mike, we all need this badly! Joel On Mar 12, 2008, at 3:09 PM, Mike Mangino wrote: > I was hoping to announce this a month ago, but some legal wrangling > took longer than expected. > > Developing Facebook Platform Applications with Rails is now available > in Beta at http://www.pragprog.com/titles/mmfacer > > It walks you through creating a Facebook application with Facebooker, > all the way from setup to handling large number of users. > > Thank all of you for asking questions on this list. I did my best to > answer all of them in the book. Expect to see more chapters shortly, > as information on FBJS, profile updating and performance are added. > > Mike > -- > Mike Mangino > http://www.elevatedrails.com > > > > _______________________________________________ > Facebooker-talk mailing list > Facebooker-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/facebooker-talk From phylae at gmail.com Thu Mar 13 03:39:34 2008 From: phylae at gmail.com (Paul Cortens) Date: Thu, 13 Mar 2008 00:39:34 -0700 Subject: [Facebooker-talk] ActionView::TemplateError when FQL query does not return any results Message-ID: I submitted this as a bug here: http://rubyforge.org/tracker/index.php?func=detail&aid=18799&group_id=4187&atid=16130 However, I just realized that I probably should have posted here first. Has anyone else had a similar experiance with queries that don't return results? I have the following FQL Query: "SELECT uid FROM user WHERE has_added_app = 1 AND uid IN (SELECT uid2 FROM friend WHERE uid1 = #{@current_facebook_user.id})" It usually works just fine. However, in the unlikely case where a user has no friends, I get this error: ActionView::TemplateError (You have a nil object when you didn't expect it! The error occurred while evaluating nil.name) If a make these changes ... Index: vendor/plugins/facebooker/lib/facebooker/parser.rb =================================================================== --- vendor/plugins/facebooker/lib/facebooker/parser.rb (revision 200) +++ vendor/plugins/facebooker/lib/facebooker/parser.rb (working copy) @@ -249,7 +249,11 @@ def self.process(data) root = element('fql_query_response', data) first_child = root.children.reject{|c| c.kind_of?(REXML::Text)}.first - [first_child.name, array_of_hashes(root, first_child.name)] + if first_child.nil? + [nil, array_of_hashes(root, nil)] + else + [first_child.name, array_of_hashes(root, first_child.name)] + end end end ==================================================================== ... then things seem to work well. I am sorry that I don't yet know enough about the facebook api or facebooker to turn this into a real patch. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/facebooker-talk/attachments/20080313/320f3ff8/attachment-0001.html From sbwoodside at yahoo.com Thu Mar 13 15:56:10 2008 From: sbwoodside at yahoo.com (S. Woodside) Date: Thu, 13 Mar 2008 15:56:10 -0400 Subject: [Facebooker-talk] a way to restrict who can install your app, for private testing In-Reply-To: <443c240c0803112013s42f574e0vcc240185bc7a70e3@mail.gmail.com> References: <6D5AB4DD-16AC-44AD-8233-DF7C58F86034@yahoo.com> <443c240c0803112013s42f574e0vcc240185bc7a70e3@mail.gmail.com> Message-ID: <9680BC3D-B8F1-4DC5-BB19-5A65D5682818@yahoo.com> I considered both of those options, but I had problems. 1. Developers -- I'm going to have quite a few (maybe 30) people that I know privately testing the app, and I don't want to make them all developers, wouldn't that give them access to the app editing/ settings etc. 2. Test users -- I tried this, but since my app developer user isn't a test user, I found that simple fbml like fb:name wouldn't work because normal users can't see test users and vice-versa. Their implementation of test users seems quite terrible. --simon -- http://simonwoodside.com On Mar 11, 2008, at 11:13 PM, Christopher Bailey wrote: > An alternative is simply to make your app not publicly installable, > and to designate certain people as "developers" of the app. You > can do this on the app's settings page on Facebook. That way you > don't have to put code in your app that you have to then take back > out, etc. > > > I also tend to leverage the "test" users you can set up. So, while > I'm doing my own testing (where only I am looking at the app, or a > small set of us), I set up some test users add them as friends, > have them add the app, etc., then go mark them as actual test > user's in Facebook, etc. I designate these as "developers" of the > app, so they have access. > > On 3/11/08, S. Woodside wrote: This is > something I just cooked up to allow me to restrict > temporarily who can access my app, based on an array of UIDs. It's > messy but works. Put at the top of your controller, at the end of > your filters. > > # This filter is only until we open everything up > before_filter do |c| > acceptable_uids = ['594180515', '122612996'] > unless acceptable_uids.include? c.get_facebook_session.user.uid > RAILS_DEFAULT_LOGGER.debug "my UID = " + > c.get_facebook_session.user.uid + " but acceptable_uids = " + > acceptable_uids.to_s > raise RuntimeError("This isn't going to work") > end > end > def get_facebook_session > @facebook_session > end > > > If it deems the user unacceptable, it actually fails with: > NoMethodError (undefined method `RuntimeError' for > FacebookController:Class): > > I don't know why, I think it's got something to do with using a block > or something. However, it still does what it's supposed to do, which > is prevent anyone not on the list from seeing your app. > > --simon > > > -- > http://simonwoodside.com > > _______________________________________________ > Facebooker-talk mailing list > Facebooker-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/facebooker-talk > > > > -- > Christopher Bailey > Cobalt Edge LLC > http://cobaltedge.com From digidigo at gmail.com Thu Mar 13 16:02:19 2008 From: digidigo at gmail.com (David Clements) Date: Thu, 13 Mar 2008 14:02:19 -0600 Subject: [Facebooker-talk] a way to restrict who can install your app, for private testing In-Reply-To: <9680BC3D-B8F1-4DC5-BB19-5A65D5682818@yahoo.com> References: <6D5AB4DD-16AC-44AD-8233-DF7C58F86034@yahoo.com> <443c240c0803112013s42f574e0vcc240185bc7a70e3@mail.gmail.com> <9680BC3D-B8F1-4DC5-BB19-5A65D5682818@yahoo.com> Message-ID: I did something like this by setting up a Facebook Group and then validating that the User was in that group. If the user was not in the group then I put up a private beta page. That way I collected session keys for people interested in the application and sent them notifications when I was ready to go live. Dave On Thu, Mar 13, 2008 at 1:56 PM, S. Woodside wrote: > I considered both of those options, but I had problems. > > 1. Developers -- I'm going to have quite a few (maybe 30) people that > I know privately testing the app, and I don't want to make them all > developers, wouldn't that give them access to the app editing/ > settings etc. > > 2. Test users -- I tried this, but since my app developer user isn't > a test user, I found that simple fbml like fb:name wouldn't work > because normal users can't see test users and vice-versa. Their > implementation of test users seems quite terrible. > > --simon > > -- > http://simonwoodside.com > > > On Mar 11, 2008, at 11:13 PM, Christopher Bailey wrote: > > > An alternative is simply to make your app not publicly installable, > > and to designate certain people as "developers" of the app. You > > can do this on the app's settings page on Facebook. That way you > > don't have to put code in your app that you have to then take back > > out, etc. > > > > > > I also tend to leverage the "test" users you can set up. So, while > > I'm doing my own testing (where only I am looking at the app, or a > > small set of us), I set up some test users add them as friends, > > have them add the app, etc., then go mark them as actual test > > user's in Facebook, etc. I designate these as "developers" of the > > app, so they have access. > > > > On 3/11/08, S. Woodside wrote: This is > > something I just cooked up to allow me to restrict > > temporarily who can access my app, based on an array of UIDs. It's > > messy but works. Put at the top of your controller, at the end of > > your filters. > > > > # This filter is only until we open everything up > > before_filter do |c| > > acceptable_uids = ['594180515', '122612996'] > > unless acceptable_uids.include? c.get_facebook_session.user.uid > > RAILS_DEFAULT_LOGGER.debug "my UID = " + > > c.get_facebook_session.user.uid + " but acceptable_uids = " + > > acceptable_uids.to_s > > raise RuntimeError("This isn't going to work") > > end > > end > > def get_facebook_session > > @facebook_session > > end > > > > > > If it deems the user unacceptable, it actually fails with: > > NoMethodError (undefined method `RuntimeError' for > > FacebookController:Class): > > > > I don't know why, I think it's got something to do with using a block > > or something. However, it still does what it's supposed to do, which > > is prevent anyone not on the list from seeing your app. > > > > --simon > > > > > > -- > > http://simonwoodside.com > > > > _______________________________________________ > > Facebooker-talk mailing list > > Facebooker-talk at rubyforge.org > > http://rubyforge.org/mailman/listinfo/facebooker-talk > > > > > > > > -- > > Christopher Bailey > > Cobalt Edge LLC > > http://cobaltedge.com > _______________________________________________ > 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/20080313/37889494/attachment.html From digidigo at gmail.com Fri Mar 14 15:38:26 2008 From: digidigo at gmail.com (David Clements) Date: Fri, 14 Mar 2008 13:38:26 -0600 Subject: [Facebooker-talk] Facebooker MQ now on RubyForge Message-ID: I don't know if anyone is using this but I just fixed a bunch of bugs, some big ones, and moved this project to RubyForge SVN servers. So you can get it here now: script/plugin install http://facebooker-mq.rubyforge.org/svn/trunk/facebooker-mq/ This is working great for me on a couple of projects. Here is the README Updated: 3/14/2008 Purpose: The purpose of FacebookerMQ is to provide an async method for performing time consuming Facebook API requests. The Facebook platform is very sensitive to long running requests, and as such it becomes important to offload some of these requests to a background process. As the name suggests this plugin relies on the facebooker api ( gem install facebooker ). Overview: FacebookerMQ intercepts Facebooker calls into session.publish(method, params) and saves all the relevant data to the database. This is inspired by the ar_mailer project which does the same for ActionMailer. In order to process the queue you can setup a cron job to run script/runner FacebookerMqRunner.work(). What you need: 1) script/plugin install http://facebooker-mq.rubyforge.org/svn/trunk/facebooker-mq/ 2) You will need a migration to create the table that holds the messages. You can think if this table as the queue class CreateFacebookMessages < ActiveRecord::Migration def self.up create_table :facebook_messages do |t| t.column(:session_key, :string, :null => false) t.column(:expires, :string, :null => false, :default => "0") t.column(:uid, :integer, :null => false) t.column(:api_method, :string, :null => false) t.column(:params, :text, :null => false ) # Always a hash. t.column(:state, :string, :null => false, :default => 'new' ) t.column(:send_after, :datetime, :null => false, :default => Time.at(0)) # Optional date time to wait until you send t.column( :last_send_attempt, :datetime ) t.column( :send_attempts, :integer, :default => 0 , :null => false ) t.column( :facebook_errors, :text, :default => "") t.column( :response_xml, :text, :default => "") t.timestamps end end def self.down drop_table :facebook_messages end end 3) Cronjob or some other way to fire off FacebookerMqRunner.work() Misc: Look in facebooker_session_override.rb and you will see all the api methods that are currently offloaded to the queue. This can be added to or removed from by calling Facebooker:: Session.async_method or Facebooker::Session.sync_method I am kinda hoping to get this pushed into the Facebooker source so that it can be a config option. If not I will setup a rubyforge project and change the URL This is a work in progress and any comments or code is totally welcome. It has been developed from a couple of projects that I am currently working on. TODO: 1) I think some of the options such as the max number of failure, which methods to intercept and table name should be configurable. 2) I think that it would be good to work out some admin view of the queue. 3) Make sure that it works well with multiple runner instances. 4) Remove the need to run this within the RAILS_ENV 5) Create a gem like ar_mailer has. 6) Implement saving response and using a callback to do something with the response. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/facebooker-talk/attachments/20080314/9af0d852/attachment.html From shanev at gmail.com Fri Mar 14 15:45:16 2008 From: shanev at gmail.com (Shane Vitarana) Date: Fri, 14 Mar 2008 14:45:16 -0500 Subject: [Facebooker-talk] Facebooker MQ now on RubyForge In-Reply-To: References: Message-ID: <4ab757a40803141245h323577aem6124615f05d5e25e@mail.gmail.com> Nice work. But would you run into issues with publishing feeds? Since they have to be publish while the user is actively logged in now? Shane On Fri, Mar 14, 2008 at 2:38 PM, David Clements wrote: > I don't know if anyone is using this but I just fixed a bunch of bugs, some > big ones, and moved this project to RubyForge SVN servers. > > So you can get it here now: > > script/plugin install > http://facebooker-mq.rubyforge.org/svn/trunk/facebooker-mq/ > > This is working great for me on a couple of projects. > > Here is the README > > Updated: 3/14/2008 > > Purpose: > The purpose of FacebookerMQ is to provide an async method for performing > time consuming > Facebook API requests. The Facebook platform is very sensitive to long > running requests, > and as such it becomes important to offload some of these requests to a > background process. > As the name suggests this plugin relies on the facebooker api ( gem install > facebooker ). > > Overview: > > FacebookerMQ intercepts Facebooker calls into session.publish(method, > params) and saves all the relevant data > to the database. This is inspired by the ar_mailer project which does the > same for ActionMailer. In order > to process the queue you can setup a cron job to run script/runner > FacebookerMqRunner.work(). > > What you need: > > 1) script/plugin install > http://facebooker-mq.rubyforge.org/svn/trunk/facebooker-mq/ > > > > 2) You will need a migration to create the table that holds the messages. > You can think if this table as the queue > > class CreateFacebookMessages < ActiveRecord::Migration > def self.up > create_table :facebook_messages do |t| > t.column(:session_key, :string, :null => false) > t.column(:expires, :string, :null => false, :default => "0") > t.column(:uid, :integer, :null => false) > t.column(:api_method, :string, :null => false) > t.column(:params, :text, :null => false ) # Always a hash. > t.column(:state, :string, :null => false, :default => 'new' ) > t.column(:send_after, :datetime, :null => false, :default => > Time.at(0)) # Optional date time to wait until you send > t.column( :last_send_attempt, :datetime ) > t.column( :send_attempts, :integer, :default => 0 , :null => false > ) > t.column( :facebook_errors, :text, :default => "") > t.column( :response_xml, :text, :default => "") > t.timestamps > end > end > > def self.down > drop_table :facebook_messages > end > end > > 3) Cronjob or some other way to fire off FacebookerMqRunner.work() > > > Misc: > > Look in facebooker_session_override.rb and you will see all the api methods > that are currently offloaded to the queue. > This can be added to or removed from by calling > Facebooker::Session.async_method or Facebooker::Session.sync_method > > I am kinda hoping to get this pushed into the Facebooker source so that it > can be a config option. If not I will setup > a rubyforge project and change the URL > > This is a work in progress and any comments or code is totally welcome. It > has been developed from a couple of projects > that I am currently working on. > > > TODO: > > 1) I think some of the options such as the max number of failure, which > methods to intercept and table name should be configurable. > 2) I think that it would be good to work out some admin view of the queue. > 3) Make sure that it works well with multiple runner instances. > 4) Remove the need to run this within the RAILS_ENV > 5) Create a gem like ar_mailer has. > 6) Implement saving response and using a callback to do something with the > response. > > > > > > _______________________________________________ > Facebooker-talk mailing list > Facebooker-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/facebooker-talk > > -- http://shanesbrain.net | http://crimsonjet.com | http://myfitbuddy.com From digidigo at gmail.com Fri Mar 14 15:47:20 2008 From: digidigo at gmail.com (David Clements) Date: Fri, 14 Mar 2008 13:47:20 -0600 Subject: [Facebooker-talk] Facebooker MQ now on RubyForge In-Reply-To: <4ab757a40803141245h323577aem6124615f05d5e25e@mail.gmail.com> References: <4ab757a40803141245h323577aem6124615f05d5e25e@mail.gmail.com> Message-ID: That is interesting. I haven't run into that. But for me feeds get updated within a minute or so , as I run the cron job every minute. Do you know how they detect that the user is logged in? Dave On Fri, Mar 14, 2008 at 1:45 PM, Shane Vitarana wrote: > Nice work. But would you run into issues with publishing feeds? Since > they have to be publish while the user is actively logged in now? > > Shane > > On Fri, Mar 14, 2008 at 2:38 PM, David Clements > wrote: > > I don't know if anyone is using this but I just fixed a bunch of bugs, > some > > big ones, and moved this project to RubyForge SVN servers. > > > > So you can get it here now: > > > > script/plugin install > > http://facebooker-mq.rubyforge.org/svn/trunk/facebooker-mq/ > > > > This is working great for me on a couple of projects. > > > > Here is the README > > > > Updated: 3/14/2008 > > > > Purpose: > > The purpose of FacebookerMQ is to provide an async method for performing > > time consuming > > Facebook API requests. The Facebook platform is very sensitive to long > > running requests, > > and as such it becomes important to offload some of these requests to a > > background process. > > As the name suggests this plugin relies on the facebooker api ( gem > install > > facebooker ). > > > > Overview: > > > > FacebookerMQ intercepts Facebooker calls into session.publish(method, > > params) and saves all the relevant data > > to the database. This is inspired by the ar_mailer project which does > the > > same for ActionMailer. In order > > to process the queue you can setup a cron job to run script/runner > > FacebookerMqRunner.work(). > > > > What you need: > > > > 1) script/plugin install > > http://facebooker-mq.rubyforge.org/svn/trunk/facebooker-mq/ > > > > > > > > 2) You will need a migration to create the table that holds the > messages. > > You can think if this table as the queue > > > > class CreateFacebookMessages < ActiveRecord::Migration > > def self.up > > create_table :facebook_messages do |t| > > t.column(:session_key, :string, :null => false) > > t.column(:expires, :string, :null => false, :default => "0") > > t.column(:uid, :integer, :null => false) > > t.column(:api_method, :string, :null => false) > > t.column(:params, :text, :null => false ) # Always a hash. > > t.column(:state, :string, :null => false, :default => 'new' ) > > t.column(:send_after, :datetime, :null => false, :default => > > Time.at(0)) # Optional date time to wait until you send > > t.column( :last_send_attempt, :datetime ) > > t.column( :send_attempts, :integer, :default => 0 , :null => > false > > ) > > t.column( :facebook_errors, :text, :default => "") > > t.column( :response_xml, :text, :default => "") > > t.timestamps > > end > > end > > > > def self.down > > drop_table :facebook_messages > > end > > end > > > > 3) Cronjob or some other way to fire off FacebookerMqRunner.work() > > > > > > Misc: > > > > Look in facebooker_session_override.rb and you will see all the api > methods > > that are currently offloaded to the queue. > > This can be added to or removed from by calling > > Facebooker::Session.async_method or Facebooker::Session.sync_method > > > > I am kinda hoping to get this pushed into the Facebooker source so that > it > > can be a config option. If not I will setup > > a rubyforge project and change the URL > > > > This is a work in progress and any comments or code is totally welcome. > It > > has been developed from a couple of projects > > that I am currently working on. > > > > > > TODO: > > > > 1) I think some of the options such as the max number of failure, which > > methods to intercept and table name should be configurable. > > 2) I think that it would be good to work out some admin view of the > queue. > > 3) Make sure that it works well with multiple runner instances. > > 4) Remove the need to run this within the RAILS_ENV > > 5) Create a gem like ar_mailer has. > > 6) Implement saving response and using a callback to do something with > the > > response. > > > > > > > > > > > > _______________________________________________ > > Facebooker-talk mailing list > > Facebooker-talk at rubyforge.org > > http://rubyforge.org/mailman/listinfo/facebooker-talk > > > > > > > > -- > http://shanesbrain.net | http://crimsonjet.com | http://myfitbuddy.com > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/facebooker-talk/attachments/20080314/96274280/attachment.html From shanev at gmail.com Fri Mar 14 15:57:05 2008 From: shanev at gmail.com (Shane Vitarana) Date: Fri, 14 Mar 2008 14:57:05 -0500 Subject: [Facebooker-talk] Facebooker MQ now on RubyForge In-Reply-To: References: <4ab757a40803141245h323577aem6124615f05d5e25e@mail.gmail.com> Message-ID: <4ab757a40803141257k63be78dewb0e54872523d9581@mail.gmail.com> Not sure how they do it. I think it should be fine if it is run every minute though. On Fri, Mar 14, 2008 at 2:47 PM, David Clements wrote: > That is interesting. I haven't run into that. But for me feeds get > updated within a minute or so , as I run the cron job every minute. > Do you know how they detect that the user is logged in? > > > Dave > > > > On Fri, Mar 14, 2008 at 1:45 PM, Shane Vitarana wrote: > > Nice work. But would you run into issues with publishing feeds? Since > > they have to be publish while the user is actively logged in now? > > > > Shane > > > > > > > > > > On Fri, Mar 14, 2008 at 2:38 PM, David Clements > wrote: > > > I don't know if anyone is using this but I just fixed a bunch of bugs, > some > > > big ones, and moved this project to RubyForge SVN servers. > > > > > > So you can get it here now: > > > > > > script/plugin install > > > http://facebooker-mq.rubyforge.org/svn/trunk/facebooker-mq/ > > > > > > This is working great for me on a couple of projects. > > > > > > Here is the README > > > > > > Updated: 3/14/2008 > > > > > > Purpose: > > > The purpose of FacebookerMQ is to provide an async method for performing > > > time consuming > > > Facebook API requests. The Facebook platform is very sensitive to long > > > running requests, > > > and as such it becomes important to offload some of these requests to a > > > background process. > > > As the name suggests this plugin relies on the facebooker api ( gem > install > > > facebooker ). > > > > > > Overview: > > > > > > FacebookerMQ intercepts Facebooker calls into session.publish(method, > > > params) and saves all the relevant data > > > to the database. This is inspired by the ar_mailer project which does > the > > > same for ActionMailer. In order > > > to process the queue you can setup a cron job to run script/runner > > > FacebookerMqRunner.work(). > > > > > > What you need: > > > > > > 1) script/plugin install > > > http://facebooker-mq.rubyforge.org/svn/trunk/facebooker-mq/ > > > > > > > > > > > > 2) You will need a migration to create the table that holds the > messages. > > > You can think if this table as the queue > > > > > > class CreateFacebookMessages < ActiveRecord::Migration > > > def self.up > > > create_table :facebook_messages do |t| > > > t.column(:session_key, :string, :null => false) > > > t.column(:expires, :string, :null => false, :default => "0") > > > t.column(:uid, :integer, :null => false) > > > t.column(:api_method, :string, :null => false) > > > t.column(:params, :text, :null => false ) # Always a hash. > > > t.column(:state, :string, :null => false, :default => 'new' ) > > > t.column(:send_after, :datetime, :null => false, :default => > > > Time.at(0)) # Optional date time to wait until you send > > > t.column( :last_send_attempt, :datetime ) > > > t.column( :send_attempts, :integer, :default => 0 , :null => > false > > > ) > > > t.column( :facebook_errors, :text, :default => "") > > > t.column( :response_xml, :text, :default => "") > > > t.timestamps > > > end > > > end > > > > > > def self.down > > > drop_table :facebook_messages > > > end > > > end > > > > > > 3) Cronjob or some other way to fire off FacebookerMqRunner.work() > > > > > > > > > Misc: > > > > > > Look in facebooker_session_override.rb and you will see all the api > methods > > > that are currently offloaded to the queue. > > > This can be added to or removed from by calling > > > Facebooker::Session.async_method or Facebooker::Session.sync_method > > > > > > I am kinda hoping to get this pushed into the Facebooker source so that > it > > > can be a config option. If not I will setup > > > a rubyforge project and change the URL > > > > > > This is a work in progress and any comments or code is totally welcome. > It > > > has been developed from a couple of projects > > > that I am currently working on. > > > > > > > > > TODO: > > > > > > 1) I think some of the options such as the max number of failure, which > > > methods to intercept and table name should be configurable. > > > 2) I think that it would be good to work out some admin view of the > queue. > > > 3) Make sure that it works well with multiple runner instances. > > > 4) Remove the need to run this within the RAILS_ENV > > > 5) Create a gem like ar_mailer has. > > > 6) Implement saving response and using a callback to do something with > the > > > response. > > > > > > > > > > > > > > > > > > _______________________________________________ > > > Facebooker-talk mailing list > > > Facebooker-talk at rubyforge.org > > > http://rubyforge.org/mailman/listinfo/facebooker-talk > > > > > > > > > > > > > > -- > > http://shanesbrain.net | http://crimsonjet.com | http://myfitbuddy.com > > > > -- http://shanesbrain.net | http://crimsonjet.com | http://myfitbuddy.com From digidigo at gmail.com Fri Mar 14 15:59:35 2008 From: digidigo at gmail.com (David Clements) Date: Fri, 14 Mar 2008 13:59:35 -0600 Subject: [Facebooker-talk] Facebooker MQ now on RubyForge In-Reply-To: <4ab757a40803141257k63be78dewb0e54872523d9581@mail.gmail.com> References: <4ab757a40803141245h323577aem6124615f05d5e25e@mail.gmail.com> <4ab757a40803141257k63be78dewb0e54872523d9581@mail.gmail.com> Message-ID: Yeah, main reason is to not get hung up during the request cycle talking to facebook api. I need to better detect errors though so that I can see if Facebook is denying my request. Dave On Fri, Mar 14, 2008 at 1:57 PM, Shane Vitarana wrote: > Not sure how they do it. I think it should be fine if it is run every > minute though. > > On Fri, Mar 14, 2008 at 2:47 PM, David Clements > wrote: > > That is interesting. I haven't run into that. But for me feeds get > > updated within a minute or so , as I run the cron job every minute. > > Do you know how they detect that the user is logged in? > > > > > > Dave > > > > > > > > On Fri, Mar 14, 2008 at 1:45 PM, Shane Vitarana > wrote: > > > Nice work. But would you run into issues with publishing feeds? Since > > > they have to be publish while the user is actively logged in now? > > > > > > Shane > > > > > > > > > > > > > > > On Fri, Mar 14, 2008 at 2:38 PM, David Clements > > wrote: > > > > I don't know if anyone is using this but I just fixed a bunch of > bugs, > > some > > > > big ones, and moved this project to RubyForge SVN servers. > > > > > > > > So you can get it here now: > > > > > > > > script/plugin install > > > > http://facebooker-mq.rubyforge.org/svn/trunk/facebooker-mq/ > > > > > > > > This is working great for me on a couple of projects. > > > > > > > > Here is the README > > > > > > > > Updated: 3/14/2008 > > > > > > > > Purpose: > > > > The purpose of FacebookerMQ is to provide an async method for > performing > > > > time consuming > > > > Facebook API requests. The Facebook platform is very sensitive to > long > > > > running requests, > > > > and as such it becomes important to offload some of these requests > to a > > > > background process. > > > > As the name suggests this plugin relies on the facebooker api ( gem > > install > > > > facebooker ). > > > > > > > > Overview: > > > > > > > > FacebookerMQ intercepts Facebooker calls into session.publish > (method, > > > > params) and saves all the relevant data > > > > to the database. This is inspired by the ar_mailer project which > does > > the > > > > same for ActionMailer. In order > > > > to process the queue you can setup a cron job to run script/runner > > > > FacebookerMqRunner.work(). > > > > > > > > What you need: > > > > > > > > 1) script/plugin install > > > > http://facebooker-mq.rubyforge.org/svn/trunk/facebooker-mq/ > > > > > > > > > > > > > > > > 2) You will need a migration to create the table that holds the > > messages. > > > > You can think if this table as the queue > > > > > > > > class CreateFacebookMessages < ActiveRecord::Migration > > > > def self.up > > > > create_table :facebook_messages do |t| > > > > t.column(:session_key, :string, :null => false) > > > > t.column(:expires, :string, :null => false, :default => > "0") > > > > t.column(:uid, :integer, :null => false) > > > > t.column(:api_method, :string, :null => false) > > > > t.column(:params, :text, :null => false ) # Always a > hash. > > > > t.column(:state, :string, :null => false, :default => 'new' > ) > > > > t.column(:send_after, :datetime, :null => false, :default > => > > > > Time.at(0)) # Optional date time to wait until you send > > > > t.column( :last_send_attempt, :datetime ) > > > > t.column( :send_attempts, :integer, :default => 0 , :null > => > > false > > > > ) > > > > t.column( :facebook_errors, :text, :default => "") > > > > t.column( :response_xml, :text, :default => "") > > > > t.timestamps > > > > end > > > > end > > > > > > > > def self.down > > > > drop_table :facebook_messages > > > > end > > > > end > > > > > > > > 3) Cronjob or some other way to fire off FacebookerMqRunner.work() > > > > > > > > > > > > Misc: > > > > > > > > Look in facebooker_session_override.rb and you will see all the api > > methods > > > > that are currently offloaded to the queue. > > > > This can be added to or removed from by calling > > > > Facebooker::Session.async_method or Facebooker::Session.sync_method > > > > > > > > I am kinda hoping to get this pushed into the Facebooker source so > that > > it > > > > can be a config option. If not I will setup > > > > a rubyforge project and change the URL > > > > > > > > This is a work in progress and any comments or code is totally > welcome. > > It > > > > has been developed from a couple of projects > > > > that I am currently working on. > > > > > > > > > > > > TODO: > > > > > > > > 1) I think some of the options such as the max number of failure, > which > > > > methods to intercept and table name should be configurable. > > > > 2) I think that it would be good to work out some admin view of the > > queue. > > > > 3) Make sure that it works well with multiple runner instances. > > > > 4) Remove the need to run this within the RAILS_ENV > > > > 5) Create a gem like ar_mailer has. > > > > 6) Implement saving response and using a callback to do something > with > > the > > > > response. > > > > > > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > Facebooker-talk mailing list > > > > Facebooker-talk at rubyforge.org > > > > http://rubyforge.org/mailman/listinfo/facebooker-talk > > > > > > > > > > > > > > > > > > > > -- > > > http://shanesbrain.net | http://crimsonjet.com | http://myfitbuddy.com > > > > > > > > > > > -- > http://shanesbrain.net | http://crimsonjet.com | http://myfitbuddy.com > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/facebooker-talk/attachments/20080314/33cbbf24/attachment-0001.html From mmangino at elevatedrails.com Fri Mar 14 16:14:13 2008 From: mmangino at elevatedrails.com (Mike Mangino) Date: Fri, 14 Mar 2008 15:14:13 -0500 Subject: [Facebooker-talk] Facebooker updates Message-ID: <3945EF55-EBF0-4153-A5C7-10CE7710C62A@elevatedrails.com> I just went through and cleaned out most of the bugs and patches. I also added a facebooker.js file that implements enough of prototype to do $() and link_to_remote with :update and remote_form_for with :update Let me know if you run into any issues with it. Mike -- Mike Mangino http://www.elevatedrails.com From chris at cobaltedge.com Fri Mar 14 16:22:18 2008 From: chris at cobaltedge.com (Christopher Bailey) Date: Fri, 14 Mar 2008 13:22:18 -0700 Subject: [Facebooker-talk] Facebooker MQ now on RubyForge In-Reply-To: References: <4ab757a40803141245h323577aem6124615f05d5e25e@mail.gmail.com> <4ab757a40803141257k63be78dewb0e54872523d9581@mail.gmail.com> Message-ID: <443c240c0803141322i4ea18245iad75e79d58886a8e@mail.gmail.com> David, this seems like a great idea. I've been using Spawn to kick off various things like this in my code. It has worked well so far, and alleviates the need for a cron job. As for the publishing thing, I wonder about that. Does the user truly have to be interactively logged in, or can you simply use their infinite session key? On 3/14/08, David Clements wrote: > > Yeah, main reason is to not get hung up during the request cycle talking > to facebook api. I need to better detect errors though so that I can see if > Facebook is denying my request. > > > Dave > > > On Fri, Mar 14, 2008 at 1:57 PM, Shane Vitarana wrote: > > > Not sure how they do it. I think it should be fine if it is run every > > minute though. > > > > On Fri, Mar 14, 2008 at 2:47 PM, David Clements > > wrote: > > > That is interesting. I haven't run into that. But for me feeds get > > > updated within a minute or so , as I run the cron job every minute. > > > Do you know how they detect that the user is logged in? > > > > > > > > > Dave > > > > > > > > > > > > On Fri, Mar 14, 2008 at 1:45 PM, Shane Vitarana > > wrote: > > > > Nice work. But would you run into issues with publishing feeds? > > Since > > > > they have to be publish while the user is actively logged in now? > > > > > > > > Shane > > > > > > > > > > > > > > > > > > > > On Fri, Mar 14, 2008 at 2:38 PM, David Clements > > > wrote: > > > > > I don't know if anyone is using this but I just fixed a bunch of > > bugs, > > > some > > > > > big ones, and moved this project to RubyForge SVN servers. > > > > > > > > > > So you can get it here now: > > > > > > > > > > script/plugin install > > > > > http://facebooker-mq.rubyforge.org/svn/trunk/facebooker-mq/ > > > > > > > > > > This is working great for me on a couple of projects. > > > > > > > > > > Here is the README > > > > > > > > > > Updated: 3/14/2008 > > > > > > > > > > Purpose: > > > > > The purpose of FacebookerMQ is to provide an async method for > > performing > > > > > time consuming > > > > > Facebook API requests. The Facebook platform is very sensitive to > > long > > > > > running requests, > > > > > and as such it becomes important to offload some of these requests > > to a > > > > > background process. > > > > > As the name suggests this plugin relies on the facebooker api ( > > gem > > > install > > > > > facebooker ). > > > > > > > > > > Overview: > > > > > > > > > > FacebookerMQ intercepts Facebooker calls into session.publish > > (method, > > > > > params) and saves all the relevant data > > > > > to the database. This is inspired by the ar_mailer project which > > does > > > the > > > > > same for ActionMailer. In order > > > > > to process the queue you can setup a cron job to run > > script/runner > > > > > FacebookerMqRunner.work(). > > > > > > > > > > What you need: > > > > > > > > > > 1) script/plugin install > > > > > http://facebooker-mq.rubyforge.org/svn/trunk/facebooker-mq/ > > > > > > > > > > > > > > > > > > > > 2) You will need a migration to create the table that holds the > > > messages. > > > > > You can think if this table as the queue > > > > > > > > > > class CreateFacebookMessages < ActiveRecord::Migration > > > > > def self.up > > > > > create_table :facebook_messages do |t| > > > > > t.column(:session_key, :string, :null => false) > > > > > t.column(:expires, :string, :null => false, :default => > > "0") > > > > > t.column(:uid, :integer, :null => false) > > > > > t.column(:api_method, :string, :null => false) > > > > > t.column(:params, :text, :null => false ) # Always a > > hash. > > > > > t.column(:state, :string, :null => false, :default => > > 'new' ) > > > > > t.column(:send_after, :datetime, :null => false, > > :default => > > > > > Time.at(0)) # Optional date time to wait until you send > > > > > t.column( :last_send_attempt, :datetime ) > > > > > t.column( :send_attempts, :integer, :default => 0 , :null > > => > > > false > > > > > ) > > > > > t.column( :facebook_errors, :text, :default => "") > > > > > t.column( :response_xml, :text, :default => "") > > > > > t.timestamps > > > > > end > > > > > end > > > > > > > > > > def self.down > > > > > drop_table :facebook_messages > > > > > end > > > > > end > > > > > > > > > > 3) Cronjob or some other way to fire off FacebookerMqRunner.work > > () > > > > > > > > > > > > > > > Misc: > > > > > > > > > > Look in facebooker_session_override.rb and you will see all the > > api > > > methods > > > > > that are currently offloaded to the queue. > > > > > This can be added to or removed from by calling > > > > > Facebooker::Session.async_method or Facebooker:: > > Session.sync_method > > > > > > > > > > I am kinda hoping to get this pushed into the Facebooker source so > > that > > > it > > > > > can be a config option. If not I will setup > > > > > a rubyforge project and change the URL > > > > > > > > > > This is a work in progress and any comments or code is totally > > welcome. > > > It > > > > > has been developed from a couple of projects > > > > > that I am currently working on. > > > > > > > > > > > > > > > TODO: > > > > > > > > > > 1) I think some of the options such as the max number of failure, > > which > > > > > methods to intercept and table name should be configurable. > > > > > 2) I think that it would be good to work out some admin view of > > the > > > queue. > > > > > 3) Make sure that it works well with multiple runner instances. > > > > > 4) Remove the need to run this within the RAILS_ENV > > > > > 5) Create a gem like ar_mailer has. > > > > > 6) Implement saving response and using a callback to do something > > with > > > the > > > > > response. > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > Facebooker-talk mailing list > > > > > Facebooker-talk at rubyforge.org > > > > > http://rubyforge.org/mailman/listinfo/facebooker-talk > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > http://shanesbrain.net | http://crimsonjet.com | > > http://myfitbuddy.com > > > > > > > > > > > > > > > > > > -- > > http://shanesbrain.net | http://crimsonjet.com | http://myfitbuddy.com > > > > > _______________________________________________ > 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/20080314/3570408a/attachment.html From digidigo at gmail.com Fri Mar 14 16:24:52 2008 From: digidigo at gmail.com (David Clements) Date: Fri, 14 Mar 2008 14:24:52 -0600 Subject: [Facebooker-talk] Facebooker updates In-Reply-To: <3945EF55-EBF0-4153-A5C7-10CE7710C62A@elevatedrails.com> References: <3945EF55-EBF0-4153-A5C7-10CE7710C62A@elevatedrails.com> Message-ID: Sweet!! I was working on this as well. I'll give it a try Thanks Mike, Dave On Fri, Mar 14, 2008 at 2:14 PM, Mike Mangino wrote: > I just went through and cleaned out most of the bugs and patches. I > also added a facebooker.js file that implements enough of prototype to > do $() and link_to_remote with :update and remote_form_for with :update > > Let me know if you run into any issues with it. > > Mike > > -- > Mike Mangino > http://www.elevatedrails.com > > > > _______________________________________________ > 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/20080314/80e4557f/attachment.html From digidigo at gmail.com Fri Mar 14 16:29:20 2008 From: digidigo at gmail.com (David Clements) Date: Fri, 14 Mar 2008 14:29:20 -0600 Subject: [Facebooker-talk] Facebooker updates In-Reply-To: References: <3945EF55-EBF0-4153-A5C7-10CE7710C62A@elevatedrails.com> Message-ID: Hey Mike, Did you have any success getting new Ajax.Request to work? This is the one that gets generated when you do an link_to_remote without the update => div_id. I could have sworn during some testing I did a few weeks ago that this would work if you wrapped your return RJS in