From snoodger4eva at yahoo.com Sun Jun 1 06:00:22 2008 From: snoodger4eva at yahoo.com (Jon) Date: Sun, 1 Jun 2008 03:00:22 -0700 Subject: [Facebooker-talk] Is Ezra's RESTful recipe needed anymore? Message-ID: Hi all, In the recent Advanced Rails Recipes book, Ezra states that Rails needs a little bit of adjustment for its restful routing to work with Facebook. He suggests created an initializer named facebook_overrides.rb and adding this code: http://pastie.caboo.se/206696 But I was just testing restful routing without that code, and Rails seemed to be working fine with Facebook. I'm using Facebooker, so I was wondering if Facebooker has integrated Ezra's code. Is Ezra's recipe needed anymore? Thanks! -JontheWayne -------------- next part -------------- An HTML attachment was scrubbed... URL: From mmangino at elevatedrails.com Sun Jun 1 10:57:39 2008 From: mmangino at elevatedrails.com (Mike Mangino) Date: Sun, 1 Jun 2008 07:57:39 -0700 Subject: [Facebooker-talk] Is Ezra's RESTful recipe needed anymore? In-Reply-To: References: Message-ID: A very similar fix was integrated right after Facebook started passing in the request method, so Ezra's code is no longer necessary. Mike On Jun 1, 2008, at 3:00 AM, Jon wrote: > Hi all, > > In the recent Advanced Rails Recipes book, Ezra states that Rails > needs a little bit of adjustment for its restful routing to work > with Facebook. He suggests created an initializer named > facebook_overrides.rb and adding this code: > > http://pastie.caboo.se/206696 > > But I was just testing restful routing without that code, and Rails > seemed to be working fine with Facebook. I?m using Facebooker, so I > was wondering if Facebooker has integrated Ezra?s code. > > Is Ezra?s recipe needed anymore? > > Thanks! > > -JontheWayne > _______________________________________________ > Facebooker-talk mailing list > Facebooker-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/facebooker-talk -- Mike Mangino http://www.elevatedrails.com From snoodger4eva at yahoo.com Sun Jun 1 11:49:50 2008 From: snoodger4eva at yahoo.com (Jon) Date: Sun, 1 Jun 2008 08:49:50 -0700 Subject: [Facebooker-talk] Is Ezra's RESTful recipe needed anymore? In-Reply-To: Message-ID: <61DE2E56E2B84B699559A5F273BA0B20@epic> Oh sweet, that's good to hear. Thanks Mike! -----Original Message----- From: Mike Mangino [mailto:mmangino at elevatedrails.com] Sent: Sunday, June 01, 2008 7:58 AM To: Jon Cc: facebooker-talk at rubyforge.org Subject: Re: [Facebooker-talk] Is Ezra's RESTful recipe needed anymore? A very similar fix was integrated right after Facebook started passing in the request method, so Ezra's code is no longer necessary. Mike On Jun 1, 2008, at 3:00 AM, Jon wrote: > Hi all, > > In the recent Advanced Rails Recipes book, Ezra states that Rails > needs a little bit of adjustment for its restful routing to work > with Facebook. He suggests created an initializer named > facebook_overrides.rb and adding this code: > > http://pastie.caboo.se/206696 > > But I was just testing restful routing without that code, and Rails > seemed to be working fine with Facebook. I'm using Facebooker, so I > was wondering if Facebooker has integrated Ezra's code. > > Is Ezra's recipe needed anymore? > > Thanks! > > -JontheWayne > _______________________________________________ > Facebooker-talk mailing list > Facebooker-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/facebooker-talk -- Mike Mangino http://www.elevatedrails.com From schroeder.ken at gmail.com Sun Jun 1 12:49:01 2008 From: schroeder.ken at gmail.com (Ken Schroeder) Date: Sun, 1 Jun 2008 12:49:01 -0400 Subject: [Facebooker-talk] Page loading popup Message-ID: Ran into a strange problem with my app. Had branched off our development tree and made some significant modeling changes and some view changes here developing locally not through facebook. When I try to test the code through facebook now I'm getting a Facebook popup dialog on anypage I try to hit of our app that just says Loading. The JS error console shows Error: this.obj.parentNode has no properties Source File: http://static.ak.fbcdn.net/rsrc.php/pkg/60/101676/js/common.js.pkg.php Line: 1242 Firebug says this.obj is div.generic_dialog. It seems the library was updated recently however using an older version of my code I'm not seeing the issue I assume /* Source: Backing Store */ 2/* Location: js/common.js.pkg.php r101676 */ 3/* Machine: 10.16.139.106 */ 4/* Generated: May 30th 2008 12:41:46 PM PDT */ 5/* HTTP Host: static.ak.fbcdn.net Been looking at it for a while now just wondering if anyone else has seen this issue recently. I'm really not sure where any of the changes we were making would caused this. Would appreciate if anyone has any ideas. Thanks --ken -------------- next part -------------- An HTML attachment was scrubbed... URL: From jonathan.otto at gmail.com Sun Jun 1 18:08:19 2008 From: jonathan.otto at gmail.com (Jonathan Otto) Date: Sun, 1 Jun 2008 17:08:19 -0500 Subject: [Facebooker-talk] Page loading popup In-Reply-To: References: Message-ID: This usually happens when one of your assets (JS or CSS file) has an inaccessible URL (htp:ww.example.com/style.css). It can also happen if the asset you are pointing to has nothing in it. On Sun, Jun 1, 2008 at 11:49 AM, Ken Schroeder wrote: > Ran into a strange problem with my app. Had branched off our development > tree and made some significant modeling changes and some view changes here > developing locally not through facebook. When I try to test the code through > facebook now I'm getting a Facebook popup dialog on anypage I try to hit of > our app that just says Loading. > > The JS error console shows > Error: this.obj.parentNode has no properties > Source File: > http://static.ak.fbcdn.net/rsrc.php/pkg/60/101676/js/common.js.pkg.php > Line: 1242 > > Firebug says this.obj is div.generic_dialog. > > It seems the library was updated recently however using an older version of > my code I'm not seeing the issue I assume > /* Source: Backing Store */ > 2/* Location: js/common.js.pkg.php r101676 */ > 3/* Machine: 10.16.139.106 */ > 4/* Generated: May 30th 2008 12:41:46 PM PDT */ > 5/* HTTP Host: static.ak.fbcdn.net > > Been looking at it for a while now just wondering if anyone else has seen > this issue recently. I'm really not sure where any of the changes we were > making would caused this. Would appreciate if anyone has any ideas. Thanks > --ken > > _______________________________________________ > Facebooker-talk mailing list > Facebooker-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/facebooker-talk > > From digidigo at gmail.com Tue Jun 3 17:18:31 2008 From: digidigo at gmail.com (David Clements) Date: Tue, 3 Jun 2008 15:18:31 -0600 Subject: [Facebooker-talk] Order of authentication methods is causing unnecessary call to API? Message-ID: Hey Guys, I am wondering if I am missing something here. I am noticing that after a user installs my app I get a request that not only contains an auth_key but also contains a valid session key. Occasionally I am seeing that Facebook server is occasionally sending a connection reset during the auth key authentication method, this caused me to notice that secure_with_token is given precedence in the code: def set_facebook_session returning session_set = session_already_secured? || secure_with_token! || secure_with_facebook_params! do if session_set capture_facebook_friends_if_available! Session.current = facebook_session end end end This seems wrong to me since secure with token makes a round trip to Facebook and secure_with_facebook_params! does not. Any thoughts or insights? Dave -------------- next part -------------- An HTML attachment was scrubbed... URL: From jordanisip at yahoo.com Fri Jun 6 03:01:12 2008 From: jordanisip at yahoo.com (Jordan Isip) Date: Fri, 6 Jun 2008 00:01:12 -0700 (PDT) Subject: [Facebooker-talk] link_to_remote Message-ID: <765973.68441.qm@web30601.mail.mud.yahoo.com> Hi All, I attempting to add a simple AJAX link on my app, using the following code: = link_to_remote "Vote Up", :url => votes_url(foo, :canvas => false), :update => "vote_#{dom_id(foo)}" Unfortunately, this results in the following JavaScript error: ln 74 on facebook's converted facebooker.js: a16056494085_options[idx("parameters")] has no properties a16056494085_pairs=a16056494085_options[idx('parameters')].split('&'); Any ideas? Do I have to do anything else special for link_to_remote (other than :canvas => false)? Thanks in advance! Jordan Isip -------------- next part -------------- An HTML attachment was scrubbed... URL: From barooo at gmail.com Fri Jun 6 13:42:51 2008 From: barooo at gmail.com (John Richardson) Date: Fri, 6 Jun 2008 12:42:51 -0500 Subject: [Facebooker-talk] 422/InvalidAuthenticityToken with fb_request_form Message-ID: <3f4b08d0806061042p79bcdab8h295d41a4263c4f5b@mail.gmail.com> All, I'm using the ActiveRecord store for sessions and have gotten form submissions to work, but I can't get the fb:request-form that's generated by fb_request_form to work, it doesn't seem to add hidden fields for the token. Should it? Can it even (add extra fields to the fb:request-form)? My view: <% content_for("challenge_content") do %> 13 <%= @challenge_message %> 14
15 <%= fb_req_choice('Accept', url_for(:controller => 'challenge', :action => 'accept')) %> 16 <%= fb_req_choice('Decline', url_for(:controller => 'challenge', :action => 'decline')) %> 17 <% end %> 18 19 <% fb_request_form('My App', "challenge_content", url_for(:controller => 'challenge', :action => 'index')) do %> 20 <%= fb_request_form_submit(:uid=> @friend_fbid, :label => 'Notify %n') %> 21 <% end %> From redinger at gmail.com Fri Jun 6 14:31:39 2008 From: redinger at gmail.com (Christopher Redinger) Date: Fri, 6 Jun 2008 14:31:39 -0400 Subject: [Facebooker-talk] 422/InvalidAuthenticityToken with fb_request_form In-Reply-To: <3f4b08d0806061042p79bcdab8h295d41a4263c4f5b@mail.gmail.com> References: <3f4b08d0806061042p79bcdab8h295d41a4263c4f5b@mail.gmail.com> Message-ID: <681d4e8f0806061131u5e1f8f68q6a451b1c00958730@mail.gmail.com> On Fri, Jun 6, 2008 at 1:42 PM, John Richardson wrote: > I'm using the ActiveRecord store for sessions and have gotten form > submissions to work, but I can't get the fb:request-form that's > generated by fb_request_form to work, it doesn't seem to add hidden > fields for the token. No, facebooker helpers don't currently add the authenticity token. I'm assuming you are running on 2.1 (or a recent version of edge)? If you want to use forgery protection with edge, you'll need to look at the patches I've submitted. I've patched the request-form helper and the facebook_form_for helper to add the authenticity token. (There are possibly others that need patching, I've been submitting them as I find them.) If you just want to use the code as I've been modifying it to work with edge, feel free to grab it from my git mirror/hack of it: http://github.com/redinger/facebooker -- Christopher Redinger http://www.agiledisciple.com From mmangino at elevatedrails.com Fri Jun 6 14:44:19 2008 From: mmangino at elevatedrails.com (Mike Mangino) Date: Fri, 6 Jun 2008 13:44:19 -0500 Subject: [Facebooker-talk] 422/InvalidAuthenticityToken with fb_request_form In-Reply-To: <681d4e8f0806061131u5e1f8f68q6a451b1c00958730@mail.gmail.com> References: <3f4b08d0806061042p79bcdab8h295d41a4263c4f5b@mail.gmail.com> <681d4e8f0806061131u5e1f8f68q6a451b1c00958730@mail.gmail.com> Message-ID: <3B77C18D-C725-49C6-A736-A75D4D040651@elevatedrails.com> Sorry about not looking at this sooner. Can everybody CC the list when you add patches? I often miss them otherwise. I will try to get these committed today. Mike On Jun 6, 2008, at 1:31 PM, Christopher Redinger wrote: > On Fri, Jun 6, 2008 at 1:42 PM, John Richardson > wrote: > >> I'm using the ActiveRecord store for sessions and have gotten form >> submissions to work, but I can't get the fb:request-form that's >> generated by fb_request_form to work, it doesn't seem to add hidden >> fields for the token. > > No, facebooker helpers don't currently add the authenticity token. I'm > assuming you are running on 2.1 (or a recent version of edge)? If you > want to use forgery protection with edge, you'll need to look at the > patches I've submitted. I've patched the request-form helper and the > facebook_form_for helper to add the authenticity token. (There are > possibly others that need patching, I've been submitting them as I > find them.) > > If you just want to use the code as I've been modifying it to work > with edge, feel free to grab it from my git mirror/hack of it: > http://github.com/redinger/facebooker > > -- > Christopher Redinger > http://www.agiledisciple.com > _______________________________________________ > Facebooker-talk mailing list > Facebooker-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/facebooker-talk -- Mike Mangino http://www.elevatedrails.com From dav at serve.com Sun Jun 8 12:27:16 2008 From: dav at serve.com (Dav Yaginuma) Date: Sun, 8 Jun 2008 09:27:16 -0700 Subject: [Facebooker-talk] Test driving Facebooker with Rspec? Message-ID: <9b1892ab0806080927m750ecef5mcb863d8e8b08f539@mail.gmail.com> I've been spiking on a Facebook application so far just to learn the Facebook(er) API, but I'd prefer to test drive. It seems to me (with my limited knowledge) that what's needed is some sort of mocking framework at the network level. I'm thinking of creating a set of YAML files similar to fixtures that represent the remote Facebook state, then overriding Facebooker::Session#post method to fake the network response. For those of you more familiar with Facebook and Facebooker, does this approach make sense? Is there already something available that will let you spec-drive a facebook app? I found a project called Fakebook on github that looks like it tries to solve the same problem, but it appears to be more heavyweight than what I'd want. It appears to be a separate process you run locally and communicate with over TCP/IP. Any advice would be appreciated. If I go down the only route I see right now it's going to be more work than I'd hoped I'd have to do just to get a simple test driven facebook application. -- Dav Yaginuma http://AkuAku.org/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From mmangino at elevatedrails.com Thu Jun 12 15:09:41 2008 From: mmangino at elevatedrails.com (Mike Mangino) Date: Thu, 12 Jun 2008 14:09:41 -0500 Subject: [Facebooker-talk] Pretty errors in development mode Message-ID: Hey everybody. It's been a while since I've spent any serious time on Facebooker. I'm going to be doing a bunch of work in the near future to support the new profile update. I'm committing a few things now. The first is pretty error messages for Rails in development mode. You'll now get a stack trace through Facebook, just like you do for normal applications. I'm also committing support for profile.setInfo. It doesn't actually work yet due to a Facebook bug. I'll commit more tests and documentation once Facebook Finally, I added facebook_get, facebook_put and facebook_delete test helper methods. These have been in my local tree for a while. There's some work to do to get things Rails2.1 compatible, but hopefully not too much. I'm moving this weekend and hope to get a lot more done next week. Mike -- Mike Mangino http://www.elevatedrails.com From wthomas989 at yahoo.com Thu Jun 12 16:39:26 2008 From: wthomas989 at yahoo.com (William Thomas) Date: Thu, 12 Jun 2008 13:39:26 -0700 (PDT) Subject: [Facebooker-talk] Session Best Practices Message-ID: <409268.29446.qm@web58704.mail.re1.yahoo.com> Hi All- I am still trying to figure out the best way to handle facebook session for my users. Here is my current flow: in my "external accounts controller" 1) before_filter :ensure_authenticated_to_facebook, :only => [:authenticate_facebook, :edit_facebook] 2) when the user links into facebook, facebooker authenticates and redirects back to my application 3) i detect the "auth_token" param in my method and store the session_key 4) now the session[:facebook_session] is good to go .... when a user logs in i detect if they have ever authorized facebook, if they have a reconstitute a facebooker session : session[:facebook_session] ||=           returning Facebooker::Session.create do |session|            session.secure_with!(facebook.sessions_key, facebook.fb_user_id, 1.day.from_now)          end  So... this all looks great. The problem is that when I add before_filter :ensure_has_status_update , :only => [:authenticate_facebook, :edit_facebook] it always asks permission to do this - even when I confirm on facebook , this before_filter thinks I don't have permission... thoughts? -------------- next part -------------- An HTML attachment was scrubbed... URL: From mmangino at elevatedrails.com Thu Jun 12 17:02:52 2008 From: mmangino at elevatedrails.com (Mike Mangino) Date: Thu, 12 Jun 2008 16:02:52 -0500 Subject: [Facebooker-talk] Session Best Practices In-Reply-To: <409268.29446.qm@web58704.mail.re1.yahoo.com> References: <409268.29446.qm@web58704.mail.re1.yahoo.com> Message-ID: <98DFA61D-B02A-4AFC-A10C-D7211038FD3D@elevatedrails.com> You should use ensure_authenticated_to_facebook for all controllers that require status update. Also, reconstituting your sessions like that will stop working shortly. Sessions will expire in one hour. Mike On Jun 12, 2008, at 3:39 PM, William Thomas wrote: > Hi All- I am still trying to figure out the best way to handle > facebook session for my users. Here is my current flow: > > in my "external accounts controller" > > 1) before_filter :ensure_authenticated_to_facebook, :only => > [:authenticate_facebook, :edit_facebook] > > 2) when the user links into facebook, facebooker authenticates and > redirects back to my application > > 3) i detect the "auth_token" param in my method and store the > session_key > > 4) now the session[:facebook_session] is good to go > > .... > > when a user logs in i detect if they have ever authorized facebook, > if they have a reconstitute a facebooker session : > session[:facebook_session] ||= > returning Facebooker::Session.create do |session| > session.secure_with!(facebook.sessions_key, > facebook.fb_user_id, 1.day.from_now) > end > > So... this all looks great. The problem is that when I add > > before_filter :ensure_has_status_update , :only => > [:authenticate_facebook, :edit_facebook] > it always asks permission to do this - even when I confirm on > facebook , this before_filter thinks I don't have permission... > > thoughts? > > > _______________________________________________ > Facebooker-talk mailing list > Facebooker-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/facebooker-talk -- Mike Mangino http://www.elevatedrails.com From alan.larkin at gmail.com Thu Jun 12 17:46:11 2008 From: alan.larkin at gmail.com (Alan Larkin) Date: Thu, 12 Jun 2008 22:46:11 +0100 Subject: [Facebooker-talk] Double Frame Problem Message-ID: <48519923.4010907@gmail.com> The only solution I've seen to the problem of the nested frame on the login/install pages (when using iframes rather than fbml), is to use JS to cause a redirect (c.f. http://rubyforge.org/pipermail/facebooker-talk/2008-May/000638.html, http://webjazz.blogspot.com/2008/03/gotchas-of-internal-iframe-facebook.html): def create_new_facebook_session_and_redirect! session[:facebook_session] = new_facebook_session render :layout => false, :inline => %Q{} end def application_is_not_installed_by_facebook_user render :layout => false, :inline => %Q{} end Has anyone got a more elegant solution? (I think) This approach is messing up my Selenium tests (as Selenium uses frames and so redirecting "top" has unwanted effects). In hopeful expectation ... From wthomas989 at yahoo.com Thu Jun 12 18:32:07 2008 From: wthomas989 at yahoo.com (William Thomas) Date: Thu, 12 Jun 2008 15:32:07 -0700 (PDT) Subject: [Facebooker-talk] Session Best Practices In-Reply-To: <98DFA61D-B02A-4AFC-A10C-D7211038FD3D@elevatedrails.com> Message-ID: <461740.12077.qm@web58709.mail.re1.yahoo.com> Wow fast responses, awesome! The session reconstitution won't work for much longer is because of the change in the Facebook API policy, correct? What will be the new way to store this, if any ? I have heard that you can still get the user to voluntarily allow the session key to never expire. I still have the issue with "update status" - facebooker doesn't think it is enabled when it really is. As for the ensure_authenticated_to_facebook being controller wide - is that a good practice or will it cause me problems later on? --- On Thu, 6/12/08, Mike Mangino <mmangino at elevatedrails.com> wrote: From: Mike Mangino <mmangino at elevatedrails.com> Subject: Re: [Facebooker-talk] Session Best Practices To: wthomas989 at yahoo.com Cc: facebooker-talk at rubyforge.org Date: Thursday, June 12, 2008, 4:02 PM You should use ensure_authenticated_to_facebook for all controllers that require status update. Also, reconstituting your sessions like that will stop working shortly. Sessions will expire in one hour. Mike On Jun 12, 2008, at 3:39 PM, William Thomas wrote: > Hi All- I am still trying to figure out the best way to handle > facebook session for my users. Here is my current flow: > > in my "external accounts controller" > > 1) before_filter :ensure_authenticated_to_facebook, :only => > [:authenticate_facebook, :edit_facebook] > > 2) when the user links into facebook, facebooker authenticates and > redirects back to my application > > 3) i detect the "auth_token" param in my method and store the > session_key > > 4) now the session[:facebook_session] is good to go > > .... > > when a user logs in i detect if they have ever authorized facebook, > if they have a reconstitute a facebooker session : > session[:facebook_session] ||= > returning Facebooker::Session.create do |session| > session.secure_with!(facebook.sessions_key, > facebook.fb_user_id, 1.day.from_now) > end > > So... this all looks great. The problem is that when I add > > before_filter :ensure_has_status_update , :only => > [:authenticate_facebook, :edit_facebook] > it always asks permission to do this - even when I confirm on > facebook , this before_filter thinks I don't have permission... > > thoughts? > > > _______________________________________________ > Facebooker-talk mailing list > Facebooker-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/facebooker-talk -- Mike Mangino http://www.elevatedrails.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From joel at i5labs.com Thu Jun 12 19:27:49 2008 From: joel at i5labs.com (Joel Watson) Date: Thu, 12 Jun 2008 16:27:49 -0700 Subject: [Facebooker-talk] Session Best Practices In-Reply-To: <461740.12077.qm@web58709.mail.re1.yahoo.com> References: <461740.12077.qm@web58709.mail.re1.yahoo.com> Message-ID: <20F6FB19-CA22-458A-A589-756AEF8797E0@i5labs.com> I'm not sure exactly how this will work, but will affect the app I'm working on as well. The official post about this change is located here: http://developers.facebook.com/news.php?blog=1&story=118 It appears as though you'll be able to get a new user session without already having an infinite session key via the Auth.getSession method. It also appears as though you'll be able to do Profile.setFBML without an existing session key as well. As I said though, I'm not 100% sure how this will work. If anyone out there has a better idea, please chime in! I'll probably be playing around with this some time in the next week or two in any case. -Joel On Jun 12, 2008, at 3:32 PM, William Thomas wrote: > Wow fast responses, awesome! > > The session reconstitution won't work for much longer is because of > the change in the Facebook API policy, correct? What will be the new > way to store this, if any ? I have heard that you can still get the > user to voluntarily allow the session key to never expire. > > I still have the issue with "update status" - facebooker doesn't > think it is enabled when it really is. > > As for the ensure_authenticated_to_facebook being controller wide - > is that a good practice or will it cause me problems later on? > > --- On Thu, 6/12/08, Mike Mangino wrote: > From: Mike Mangino > Subject: Re: [Facebooker-talk] Session Best Practices > To: wthomas989 at yahoo.com > Cc: facebooker-talk at rubyforge.org > Date: Thursday, June 12, 2008, 4:02 PM > > You should use ensure_authenticated_to_facebook for all controllers > that require status update. Also, reconstituting your sessions like > that will stop working shortly. Sessions will expire in one hour. > > Mike > > On Jun 12, 2008, at 3:39 PM, William Thomas wrote: > > > Hi All- I am still trying to figure out the best way to handle > > facebook session for my users. Here is my current flow: > > > > in my "external accounts controller" > > > > 1) before_filter :ensure_authenticated_to_facebook, :only => > > [:authenticate_facebook, :edit_facebook] > > > > 2) when the user links into facebook, facebooker authenticates and > > redirects back to my > application > > > > 3) i detect the "auth_token" param in my method and store the > > session_key > > > > 4) now the session[:facebook_session] is good to go > > > > .... > > > > when a user logs in i detect if they have ever authorized facebook, > > if they have a reconstitute a facebooker session : > > session[:facebook_session] ||= > > returning Facebooker::Session.create do |session| > > session.secure_with!(facebook.sessions_key, > > facebook.fb_user_id, 1.day.from_now) > > end > > > > So... this all looks great. The problem is that when I add > > > > before_filter :ensure_has_status_update , :only => > > [:authenticate_facebook, :edit_facebook] > > it always asks permission to do this - even when I confirm on > > facebook , this before_filter thinks I don't have permission... > > > > > thoughts? > > > > > > _______________________________________________ > > 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: From mmangino at elevatedrails.com Fri Jun 13 09:41:16 2008 From: mmangino at elevatedrails.com (Mike Mangino) Date: Fri, 13 Jun 2008 08:41:16 -0500 Subject: [Facebooker-talk] Session Best Practices In-Reply-To: <20F6FB19-CA22-458A-A589-756AEF8797E0@i5labs.com> References: <461740.12077.qm@web58709.mail.re1.yahoo.com> <20F6FB19-CA22-458A-A589-756AEF8797E0@i5labs.com> Message-ID: Can every chime in and say what you use a stored session for? Right now, we use them for messaging, profile updates and feeds. Messaging and feeds no longer need the session key, but feeds do. I'll probably change my code to store the session key and its expiration date. How would everybody feel about a facebook_authentication plugin? It would be similar to restful_authentication, but for Facebook applications. I can do an extraction of our code that is in use for millions of users. Would that be helpful? Mike On Jun 12, 2008, at 6:27 PM, Joel Watson wrote: > I'm not sure exactly how this will work, but will affect the app I'm > working on as well. The official post about this change is located > here: > > http://developers.facebook.com/news.php?blog=1&story=118 > > It appears as though you'll be able to get a new user session > without already having an infinite session key via the > Auth.getSession method. It also appears as though you'll be able to > do Profile.setFBML without an existing session key as well. As I > said though, I'm not 100% sure how this will work. If anyone out > there has a better idea, please chime in! I'll probably be playing > around with this some time in the next week or two in any case. > > -Joel -- Mike Mangino http://www.elevatedrails.com From wthomas989 at yahoo.com Fri Jun 13 10:28:20 2008 From: wthomas989 at yahoo.com (William Thomas) Date: Fri, 13 Jun 2008 07:28:20 -0700 (PDT) Subject: [Facebooker-talk] Session Best Practices Message-ID: <548733.4274.qm@web58710.mail.re1.yahoo.com> In general I am using Facebooker to access the list of friends a user has. I am using the Facebook session store so I can update a Facebook user's status from my server. Eventually I would like to be able to access a Facebook user's groups and events. Reading more - it looks like facebooker may want to support the facebook.users.hasAppPermission call to determine the application's permission. Second- it looks like my session concerns will become moot after July 15th, as user.setStaus will not require a session key either. The facebook_authentication plugin sounds interesting. I think it may match the new FB api coming out - since they are not requiring sessions for a good amount of calls. --- On Fri, 6/13/08, Mike Mangino <mmangino at elevatedrails.com> wrote: From: Mike Mangino <mmangino at elevatedrails.com> Subject: Re: [Facebooker-talk] Session Best Practices To: "Joel Watson" <joel at i5labs.com> Cc: facebooker-talk at rubyforge.org Date: Friday, June 13, 2008, 8:41 AM Can every chime in and say what you use a stored session for? Right now, we use them for messaging, profile updates and feeds. Messaging and feeds no longer need the session key, but feeds do. I'll probably change my code to store the session key and its expiration date. How would everybody feel about a facebook_authentication plugin? It would be similar to restful_authentication, but for Facebook applications. I can do an extraction of our code that is in use for millions of users. Would that be helpful? Mike On Jun 12, 2008, at 6:27 PM, Joel Watson wrote: > I'm not sure exactly how this will work, but will affect the app I'm > working on as well. The official post about this change is located > here: > > http://developers.facebook.com/news.php?blog=1&story=118 > > It appears as though you'll be able to get a new user session > without already having an infinite session key via the > Auth.getSession method. It also appears as though you'll be able to > do Profile.setFBML without an existing session key as well. As I > said though, I'm not 100% sure how this will work. If anyone out > there has a better idea, please chime in! I'll probably be playing > around with this some time in the next week or two in any case. > > -Joel -- 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: From ramkaka at gmail.com Sun Jun 15 01:27:11 2008 From: ramkaka at gmail.com (Ram Ravichandran) Date: Sun, 15 Jun 2008 01:27:11 -0400 Subject: [Facebooker-talk] Choosing the right session store Message-ID: Hi everyone, I am currently using the activerecord session store for my app built using Facebooker. I know that Facebook has recently released support for cookies (though still in Beta). I was wondering if anyone knows how to use that for the session store. My AR Session store is filling up like crazy - I have about a 100 sessions created in less than a second by a single user. (BTW, is this normal? - they all have the same data but different session ids). Also, does anyone know how long do we have to keep the sessions around? Or, even if we do need them? Can I turn off sessions? Thanks, Ram PS: Obviously, I am a newbie :) -------------- next part -------------- An HTML attachment was scrubbed... URL: From jordanr at cs.washington.edu Sun Jun 15 18:29:53 2008 From: jordanr at cs.washington.edu (Richard Jordan) Date: Sun, 15 Jun 2008 15:29:53 -0700 (PDT) Subject: [Facebooker-talk] [PATCH] helper to create fb css stylized table Message-ID: I attached a rails helper implementation of the fb_table described here: http://wiki.developers.facebook.com/index.php/Facebook_Styles I included testing and comments. I hope you find it useful. Curiously, it's really a small extension of FBML. Richard -------------- next part -------------- Index: test/rails_integration_test.rb =================================================================== --- test/rails_integration_test.rb (revision 221) +++ test/rails_integration_test.rb (working copy) @@ -431,6 +431,37 @@ ActionController::Base.asset_host='http://facebook.host.com' end + def test_fb_table + assert_equal "
", @h.fb_table{} + end + def test_fb_tr + assert_equal "", @h.fb_tr{} + end + def test_fb_td + assert_equal "", @h.fb_td{} + end + def test_fb_th + assert_equal "

List 1

See All", @h.fb_th("List 1","#","See All") + end + def test_fb_tf + assert_equal "", @h.fb_tf("#","See all List 1s") + end + def test_fb_th_spacer + assert_equal "", @h.fb_th_spacer + end + def test_fb_td_spacer + assert_equal "", @h.fb_td_spacer + end + def test_fb_tf_spacer + assert_equal "", @h.fb_tf_spacer + end + def test_fb_first_list_item + assert_equal "
", @h.fb_first_list_item{} + end + def test_fb_list_item + assert_equal "
", @h.fb_list_item{} + end + def test_fb_profile_pic assert_equal "", @h.fb_profile_pic("1234") end @@ -806,4 +837,4 @@ end # rescue LoadError # $stderr.puts "Couldn't find action controller. That's OK. We'll skip it." -end \ No newline at end of file +end Index: lib/facebooker/rails/helpers.rb =================================================================== --- lib/facebooker/rails/helpers.rb (revision 221) +++ lib/facebooker/rails/helpers.rb (working copy) @@ -8,6 +8,197 @@ # module Helpers + # Create a multi-list table + # See: http://wiki.developers.facebook.com/index.php/Facebook_Styles for details + # + # You must call fb_css() to include the css styles. You can include the css by + # putting <%= fb_css() %> in your layout. + # + # Inside use helper methods: fb_tr, fb_td, fb_first_list_item, + # fb_list_item, fb_th, fb_tf, + # fb_th_spacer, fb_td_spacer, fb_tf_spacer. + # + # For example (modeled after the basic code on the facebook wiki), + # + # <% fb_table do %> + # <% fb_tr do %> + # <%= fb_th("List 1", "#", "See All") %> + # <%= fb_th_spacer%> + # <%= fb_th("List 2", "#", "See All") %> + # <% end %> + # <% fb_tr do %> + # <% fb_td do %> + # <% fb_first_list_item do %> + # INSERT FIRST ITEM HERE + # <% end %> + # <% fb_list_item do %> + # INSERT ANOTHER ITEM HERE + # <% end %> + # <% end %> + # <%= fb_td_spacer %> + # <% fb_td do %> + # <% fb_first_list_item do %> + # INSERT FIRST ITEM HERE + # <% end %> + # <% fb_list_item do %> + # INSERT ANOTHER ITEM HERE + # <% end %> + # <% end %> + # <% end %> + # <% fb_tr do %> + # <%= fb_tf("#", "See all List 1's") %> + # <%= fb_tf_spacer%> + # <%= fb_tf("#", "See all List 2's") %> + # <% end %> + # <% end %> + def fb_table(options={}, &block) + options.merge!(:class=>"lists",:cellspacing=>"0", :border=>"0") + content = capture(&block) + content_tag(:div, + concat(content_tag(:table, content,stringify_vals(options) ), + block.binding + ) + ) + end + + # Include styles that are used by Facebook. + # Best to include in your layout with your other css. + # Required for fb_table. See the example there. + # See: http://wiki.developers.facebook.com/index.php/Facebook_Styles for more details + def fb_css + '' + end + + # Render a facebook styled tr tag. + # Use this in conjunction with fb_table. + # Provide any options you like. + def fb_tr(&block) + content = capture(&block) + concat(content_tag(:tr,content),block.binding) + end + + # Render a facebook styled td tag. + # Use this in conjunction with fb_table. + # Provide any options you like. The default options + # include {:style=>"width:306px"}, the perfect width for + # a two list table. If you use options or want a + # different width, reset the style accordingly. + def fb_td(options={:style=>"width:306px"},&block) + options.merge!(:class=>"list") + content = capture(&block) + concat(content_tag(:td,content,stringify_vals(options)), block.binding) + end + + # Render a facebook styled first list element. + # Use this in conjunction with fb_table. See the example there. + # This first element has no padding above it. + # Provide any options you like. + def fb_first_list_item(options={},&block) + content = capture(&block) + options.merge!(:class=>'list_item.first clearfix') + concat(content_tag(:div,content,stringify_vals(options)),block.binding) + end + + # Render a facebook styled list element. + # Use this in conjunction with fb_table. See the example there. + # Unlike the first element, this element has padding above it. + # Provide any options you like. + def fb_list_item(options={}, &block) + content = capture(&block) + options.merge!(:class=>'list_item clearfix') + concat(content_tag(:div,content,stringify_vals(options)),block.binding) + end + + # Renders a facebook styled table header. + # Use this in conjunction with fb_table. See the example there. + # Provide a title for the list, a url, a label for that url, and any options. + def fb_th(title,url,label, options={} ) + options.merge!(:href=>url) + content_tag(:th,content_tag(:h4,title)+ + content_tag(:a,label,stringify_vals(options)) + ) + end + + # Renders a facebook styled table footer. + # Use this in conjunction with fb_table. See the example there. + # Provide a url,a label for that url, and any options + # for the td tag and/or the a tag. + def fb_tf(url, label,td_options={},a_options={}) + td_options.merge!(:class=>"see_all") + a_options.merge!(:href=>url) + content_tag(:td, + content_tag(:div, + content_tag(:a,label,stringify_vals(a_options)) + ), stringify_vals(td_options) + ) + end + + # Renders a facebook styled spacer for between calls to fb_th. + # Use this in conjunction with fb_table. See the example there. + # Provide any options. + def fb_th_spacer(options={}) + options.merge!(:class=>"spacer") + tag(:th, stringify_vals(options)) + end + + # Renders a facebook styled spacer for between calls to fb_td. + # Use this in conjunction with fb_table. See the example there. + # Provide any options. + def fb_td_spacer(options={}) + options.merge!(:class=>"spacer") + tag(:td, stringify_vals(options)) + end + + # Renders a facebook styled spacer for between calls to fb_tf. + # Use this in conjunction with fb_table. See the example there. + # Provide any options. + def fb_tf_spacer(options={}) + fb_td_spacer(options) + end # Create an fb:dialog # id must be a unique name e.g. "my_dialog" @@ -581,4 +772,4 @@ self[newkey] = self.delete(oldkey) if self.has_key?(oldkey) self end -end \ No newline at end of file +end From digidigo at gmail.com Mon Jun 16 11:35:05 2008 From: digidigo at gmail.com (David Clements) Date: Mon, 16 Jun 2008 09:35:05 -0600 Subject: [Facebooker-talk] Session Best Practices In-Reply-To: References: <461740.12077.qm@web58709.mail.re1.yahoo.com> <20F6FB19-CA22-458A-A589-756AEF8797E0@i5labs.com> Message-ID: Our application is a MeetingWave.... People create open invitations to meet around a topic of their choice. It is an extension of a Web App... I use stored session ids for 1) Updating profiles once a day ---- I only need one key for this but I use individual ones. 2) Sending notifications to users when they have a activity on one of their Invites --- This activity could come from a non-facebook user. 3) If a user is integrated with Facebook and they post an invite on the web site then we push a News Feed item into Facebook ---- I think this will break when they cut us off from the infinite key , right? I think that number 3 is the only thing that is going to break right? And perhaps this is the real intention of Facebook is to limit the News and Mini feeds to activity that happens within facebook. Dave On Fri, Jun 13, 2008 at 7:41 AM, Mike Mangino wrote: > Can every chime in and say what you use a stored session for? > > Right now, we use them for messaging, profile updates and feeds. Messaging > and feeds no longer need the session key, but feeds do. I'll probably change > my code to store the session key and its expiration date. > > How would everybody feel about a facebook_authentication plugin? It would > be similar to restful_authentication, but for Facebook applications. I can > do an extraction of our code that is in use for millions of users. Would > that be helpful? > > Mike > > > > On Jun 12, 2008, at 6:27 PM, Joel Watson wrote: > > I'm not sure exactly how this will work, but will affect the app I'm >> working on as well. The official post about this change is located here: >> >> http://developers.facebook.com/news.php?blog=1&story=118 >> >> It appears as though you'll be able to get a new user session without >> already having an infinite session key via the Auth.getSession method. It >> also appears as though you'll be able to do Profile.setFBML without an >> existing session key as well. As I said though, I'm not 100% sure how this >> will work. If anyone out there has a better idea, please chime in! I'll >> probably be playing around with this some time in the next week or two in >> any case. >> >> -Joel >> > > -- > 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: From taweili at yahoo.com Mon Jun 16 15:22:37 2008 From: taweili at yahoo.com (David Li) Date: Tue, 17 Jun 2008 03:22:37 +0800 Subject: [Facebooker-talk] Registering Templates: New API Methods Message-ID: <8A4D8A00-DB81-49D6-9828-51A0278CB158@yahoo.com> Hi, I am wondering if there is anyone working on integrating the new API for registering the templates? I am doing some integration with the new profile and will work on adding those into the Facebooker. Just to make sure that I don't reinvent the wheel. More specifically, 1. Template registration ? feed.registerTemplateBundle: Builds a template bundle around the specified templates, registers them with Facebook servers, and responds with a template bundle identifier that can be used to identify your template bundle to other feed-related API calls. ? feed.getRegisteredTemplateBundles: Retrieves the full list of all the template bundles registered by the requesting application. ? feed.getRegisteredTemplateBundleByID: Retrieves information about a specified template bundle previously registered by the requesting application. ? feed.publishUserAction: Publishes a story on behalf of the user owning the session, using the specified template bundle. Unlike the previous three API calls, this method requires an active session key in order to be called. http://wiki.developers.facebook.com/index.php/New_Design_Platform_Changes 2. The JSON based Publisher interaction http://wiki.developers.facebook.com/index.php/New_Design_Publisher Thanks. David Li From bjclark at scidept.com Mon Jun 16 15:58:09 2008 From: bjclark at scidept.com (BJ Clark) Date: Mon, 16 Jun 2008 13:58:09 -0600 Subject: [Facebooker-talk] Registering Templates: New API Methods In-Reply-To: <8A4D8A00-DB81-49D6-9828-51A0278CB158@yahoo.com> References: <8A4D8A00-DB81-49D6-9828-51A0278CB158@yahoo.com> Message-ID: <19C1772B-B458-48EA-A3C0-B3EE0227C0A6@scidept.com> David, I believe Mike has all of this implemented, but was waiting to commit it because not all of it works yet (on facebook's side). Mike, maybe you could share a patch with the list for those of us that want to get a jump on it? BJ Clark On Jun 16, 2008, at 1:22 PM, David Li wrote: > Hi, > > I am wondering if there is anyone working on integrating the new > API for registering the templates? I am doing some integration with > the new profile and will work on adding those into the Facebooker. > Just to make sure that I don't reinvent the wheel. More specifically, > > 1. Template registration > ? feed.registerTemplateBundle: Builds a template bundle around the > specified templates, registers them with Facebook servers, and > responds with a template bundle identifier that can be used to > identify your template bundle to other feed-related API calls. > ? feed.getRegisteredTemplateBundles: Retrieves the full list of all > the template bundles registered by the requesting application. > ? feed.getRegisteredTemplateBundleByID: Retrieves information about > a specified template bundle previously registered by the requesting > application. > ? feed.publishUserAction: Publishes a story on behalf of the user > owning the session, using the specified template bundle. Unlike the > previous three API calls, this method requires an active session key > in order to be called. > > http://wiki.developers.facebook.com/index.php/New_Design_Platform_Changes > > 2. The JSON based Publisher interaction > http://wiki.developers.facebook.com/index.php/New_Design_Publisher > > Thanks. > > > David Li > > _______________________________________________ > Facebooker-talk mailing list > Facebooker-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/facebooker-talk From chippy2005 at gmail.com Mon Jun 16 19:02:59 2008 From: chippy2005 at gmail.com (chippy chippy) Date: Tue, 17 Jun 2008 00:02:59 +0100 Subject: [Facebooker-talk] how/where to rescue TooManyUserActionCalls on mini feed Message-ID: <73c11890806161602u199aeb35xefbe492da739190e@mail.gmail.com> Hello, I've a little app up and running, and have only come across this error a couple of times, but would like to rescue it to be able to fail gracefully. Testing to see if this could work would be problematic as once I've hit the limit, I have to wait a few hours to try again!, so I'm asking your advice :) The relevant bits of code is based on: http://apps.facebook.com/facebooker_tutorial/messaging/mini_feed my attempt: def mini_feed strength begin @userF = session[:facebook_session].user profile_url = "http://www.facebook.com/profile.php?id=" + @userF.uid FacebookPublisher.deliver_mini_feed(facebook_session.user, strength) rescue Facebooker::Session::TooManyUserActionCalls flash[:notice] = "

Whoops, you've reached the limit for adding news items today, try again tomorrow.

" else flash[:notice] = "

Great stuff! a news item with the results has been added to your mini feed.

" end end Does this seem ok? Or should I be rescuing it in the facebook_publisher.rb class, or in the controller method that calls mini_feed() ? many thanks! Tim From bjclark at scidept.com Mon Jun 16 22:57:07 2008 From: bjclark at scidept.com (BJ Clark) Date: Mon, 16 Jun 2008 20:57:07 -0600 Subject: [Facebooker-talk] Rails 2.1 and Facebooker Bug Message-ID: Hello all, Just wondering if anyone has run into this bug or fixed it yet: http://rubyforge.org/tracker/index.php?func=detail&aid=20631&group_id=4187&atid=16130 We are also experiencing it with rails 2.1. I don't want to go diving into it if it's already fixed. Is anyone aware of any other rails 2.1 and Facebooker bugs? We'd like to put in the work to get Facebooker stable on Rails 2.1 Thanks, BJ Clark Inigral.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From taweili at yahoo.com Tue Jun 17 00:04:50 2008 From: taweili at yahoo.com (David Li) Date: Tue, 17 Jun 2008 12:04:50 +0800 Subject: [Facebooker-talk] Registering Templates: New API Methods In-Reply-To: <19C1772B-B458-48EA-A3C0-B3EE0227C0A6@scidept.com> References: <8A4D8A00-DB81-49D6-9828-51A0278CB158@yahoo.com> <19C1772B-B458-48EA-A3C0-B3EE0227C0A6@scidept.com> Message-ID: <3D0E9667-B074-47B7-B3BD-14A2A638E22F@yahoo.com> Hi BJ, Thanks for the answer. I will contact Mike to see if he has it somewhere. David On Jun 17, 2008, at 3:58 AM, BJ Clark wrote: > David, > > I believe Mike has all of this implemented, but was waiting to > commit it because not all of it works yet (on facebook's side). > Mike, maybe you could share a patch with the list for those of us > that want to get a jump on it? > > BJ Clark > > On Jun 16, 2008, at 1:22 PM, David Li wrote: > >> Hi, >> >> I am wondering if there is anyone working on integrating the new >> API for registering the templates? I am doing some integration with >> the new profile and will work on adding those into the Facebooker. >> Just to make sure that I don't reinvent the wheel. More specifically, >> >> 1. Template registration >> ? feed.registerTemplateBundle: Builds a template bundle around the >> specified templates, registers them with Facebook servers, and >> responds with a template bundle identifier that can be used to >> identify your template bundle to other feed-related API calls. >> ? feed.getRegisteredTemplateBundles: Retrieves the full list of >> all the template bundles registered by the requesting application. >> ? feed.getRegisteredTemplateBundleByID: Retrieves information >> about a specified template bundle previously registered by the >> requesting application. >> ? feed.publishUserAction: Publishes a story on behalf of the user >> owning the session, using the specified template bundle. Unlike the >> previous three API calls, this method requires an active session >> key in order to be called. >> >> http://wiki.developers.facebook.com/index.php/New_Design_Platform_Changes >> >> 2. The JSON based Publisher interaction >> http://wiki.developers.facebook.com/index.php/New_Design_Publisher >> >> Thanks. >> >> >> David Li >> >> _______________________________________________ >> Facebooker-talk mailing list >> Facebooker-talk at rubyforge.org >> http://rubyforge.org/mailman/listinfo/facebooker-talk > From bjclark at scidept.com Tue Jun 17 00:05:39 2008 From: bjclark at scidept.com (BJ Clark) Date: Mon, 16 Jun 2008 22:05:39 -0600 Subject: [Facebooker-talk] Rails 2.1 and Facebooker Bug In-Reply-To: References: Message-ID: Hello All Again, We figured out that a method called check_view_paths is causing the error. For whatever reason, this method was in 2.1 but has been removed since 2.1 came out. http://github.com/rails/rails/commit/55791c6c0012d0daea2a75b6a5927f459be25c54 So, if you run into this problem, all you need to do is update to rails edge from github and you should be good to go! BJ Clark Inigral.com On Jun 16, 2008, at 8:57 PM, BJ Clark wrote: > Hello all, > > Just wondering if anyone has run into this bug or fixed it yet: > http://rubyforge.org/tracker/index.php?func=detail&aid=20631&group_id=4187&atid=16130 > > We are also experiencing it with rails 2.1. > I don't want to go diving into it if it's already fixed. > > Is anyone aware of any other rails 2.1 and Facebooker bugs? We'd > like to put in the work to get Facebooker stable on Rails 2.1 > > > Thanks, > BJ Clark > Inigral.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: From aurelien.malisart at gmail.com Thu Jun 19 05:46:28 2008 From: aurelien.malisart at gmail.com (=?ISO-8859-1?Q?Aur=E9lien_Malisart?=) Date: Thu, 19 Jun 2008 11:46:28 +0200 Subject: [Facebooker-talk] facebook apps developement "process" Message-ID: <83adaa130806190246r2578c09v7022cf7e1aeafb15@mail.gmail.com> Hi everybody. New to facebook plateform and at the moment giving a try to Facebooker. I've developed a simple test app just to see how it works, and I'm wondering how you organize your work and deployment process. 1) When you're developing. Do you commit/push with your favorite SCM tool each time you modify something just to see if it works or not (and debug)? Not very convenient... Or, do you use some tunneling-hack to send the requests to your local dev machine or something like this? 2) How do you deal with development/production apps? Do you register two apps on FB? I mean one for dev and one for production. And then switch between them? Thanks! aurels -------------- next part -------------- An HTML attachment was scrubbed... URL: From alan.larkin at gmail.com Thu Jun 19 06:17:33 2008 From: alan.larkin at gmail.com (Alan Larkin) Date: Thu, 19 Jun 2008 11:17:33 +0100 Subject: [Facebooker-talk] facebook apps developement "process" In-Reply-To: <83adaa130806190246r2578c09v7022cf7e1aeafb15@mail.gmail.com> References: <83adaa130806190246r2578c09v7022cf7e1aeafb15@mail.gmail.com> Message-ID: <485A323D.7090907@gmail.com> Aur?lien Malisart wrote: > 1) When you're developing. > > Do you commit/push with your favorite SCM tool each time you modify > something just to see if it works or not (and debug)? > Not very convenient... Set the callback url to be http://localhost[:port]/ and the app will run off your machine, avoiding the need to commit just to test. If youre using FBML rather than iframe then localhost won't work ... you'll need to specify an externally accessible IP I think. That setup would imply that yes you would probably want to register a production and development (with the developer mode ticked) app on FB. HTH From mmangino at elevatedrails.com Thu Jun 19 07:54:52 2008 From: mmangino at elevatedrails.com (Mike Mangino) Date: Thu, 19 Jun 2008 07:54:52 -0400 Subject: [Facebooker-talk] facebook apps developement "process" In-Reply-To: <83adaa130806190246r2578c09v7022cf7e1aeafb15@mail.gmail.com> References: <83adaa130806190246r2578c09v7022cf7e1aeafb15@mail.gmail.com> Message-ID: Here's a shameless plug: Check out Tunnlr: http://tunnlr.com It makes the tunneling hack effortless. That's how we develop all of our applications. Mike On Jun 19, 2008, at 5:46 AM, Aur?lien Malisart wrote: > Hi everybody. New to facebook plateform and at the moment giving a > try to Facebooker. > > I've developed a simple test app just to see how it works, and I'm > wondering how you organize your work and deployment process. > > 1) When you're developing. > > Do you commit/push with your favorite SCM tool each time you modify > something just to see if it works or not (and debug)? > Not very convenient... > > Or, do you use some tunneling-hack to send the requests to your > local dev machine or something like this? > > 2) How do you deal with development/production apps? > > Do you register two apps on FB? I mean one for dev and one for > production. And then switch between them? > > Thanks! > > aurels > _______________________________________________ > Facebooker-talk mailing list > Facebooker-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/facebooker-talk -- Mike Mangino http://www.elevatedrails.com From jordanr at cs.washington.edu Thu Jun 19 13:04:33 2008 From: jordanr at cs.washington.edu (Richard Jordan) Date: Thu, 19 Jun 2008 10:04:33 -0700 (PDT) Subject: [Facebooker-talk] [PATCH] facebook_link_to In-Reply-To: References: Message-ID: I've attached a patch for a facebook_link_to which supports the :confirm and :method options. Usually, link_to spits out non-facebook-compliant javascript. I used fbjs instead. The first attachment, a new ruby file that you should call facebook_url_helper.rb, should be placed in lib/facebooker/rails/. The other diff file is probably self explanatory. Everyone does such a good job on facebooker I am insecure about my code. Please, tell me if you see any improvements, especially if you are handy with fbjs. I think the :back and :popup options are impossible with fbjs. Please correct me if I am wrong. Richard -------------- next part -------------- module Facebooker module Rails module Helpers module UrlHelperExtensions # Creates a link tag. If you do not pass any options, then it acts # exactly the same as link_to. See the documention there. # # Otherwise, it has some limitations because of # differences between JavaScript(JS) and Facebook Javascript(FBJS). # These include # * You cannot use :back to link to the referrer. # * You cannot use :popup to open a new window. # * You cannot use :href to specify the link location. # As FBJS and Facebooker evolves, these limitations may disapear or # be overcomed. # # ==== Options # * :confirm => 'question?' - This will add a Facebook Javascript # dialog with the question specified. If the user accepts, the link is # processed normally, otherwise no action is taken. # * :method => symbol of HTTP verb - This modifier will statically # create an HTML form and immediately submit the form for processing using # the HTTP verb specified. Unlike link_to, it mostly avoids Facebook # Javascript and instead wraps the link in an invisible form. Beware it # sets the form id to "_form"+ID_NUMBER+"_". Do not use such an id # elsewhere. # * The +html_options+ will accept a hash of html attributes for the link tag. # # ==== Examples # It conforms to Facebook Javascript unlike link_to. Specifically, link_to fails with # Facebook Javascript when using the :method and :confirm # options. Use as follows: # # facebook_link_to "Visit Awesome Site", "http://facebooker.rubyforge.org/", :confirm => "Are you sure?" # # => Visit Awesome Site # # facebook_link_to "Delete Image", @image, :confirm => "Are you sure?", :method => :delete # # =>

#
# # Delete Image #
#
# # facebook_link_to "Delete without confirmation", @image, :method => :delete # # =>
# #
def facebook_link_to(name, options = {}, html_options = nil) # maybe javascript is not needed, so just do the regular link_to return link_to(name,options,html_options) unless(html_options) html_options = html_options.stringify_keys return link_to(name,options,html_options) unless(javascript_needed?(html_options) ) url = options.is_a?(String) ? options : self.url_for(options) # save the method method = html_options['method'] convert_options_to_facebook_javascript!(html_options, url) tag_options = tag_options(html_options) link_tag = "#{name || url}" return link_tag unless method # fbjs is tricky so we will make a form to look like the link method_tag = '' if (%w{put delete}.include?(method.to_s) ) method_tag = tag('input', :type => 'hidden', :name => '_method', :value => method.to_s) end form_method = method.to_s == 'get' ? 'get' : 'post' request_token_tag = '' if form_method == 'post' && protect_against_forgery? request_token_tag = tag(:input, :type => "hidden", :name => request_forgery_protection_token.to_s, :value => form_authenticity_token) end form_id_attr = "id=\"_form#{@@form_id.to_s}_\"" # increment the form_id so we don't reuse it # all our forms then will have a unique id @@form_id = @@form_id + 1 "
" + method_tag + link_tag + request_token_tag + "
" end private # Makes sure the right form submits @@form_id=0 # Returns true when we must create an onclick tag. def javascript_needed?(html_options) (html_options["confirm"] || html_options["popup"] || html_options["method"]) end # Does not allow href or popup attributes. def convert_options_to_facebook_javascript!(html_options, url = '') confirm, popup = html_options.delete("confirm"), html_options.delete("popup") method, href = html_options.delete("method"), html_options['href'] html_options["onclick"] = case when href || popup raise ActionView::ActionViewError, "You can't use :href or :popup -- at least yet" when confirm && method "#{confirm_facebook_javascript_function(confirm, url, href, method)}" when confirm "#{confirm_facebook_javascript_function(confirm, url, href)};" when method "#{method_submit}" else html_options["onclick"] end end def method_submit form_id = "_form#{@@form_id.to_s}_" "document.getElementById('#{escape_javascript(form_id)}').submit(); return false;" end def change_location(url) "document.setLocation('#{escape_javascript(url)}'); return false;" end # Creates a facebook dialog. def confirm_facebook_javascript_function(confirm, url, href, method_defined=false) "new Dialog().showChoice('','#{escape_javascript(confirm)}').onconfirm = function() { #{method_defined ? method_submit : change_location(url)} }" end #### Gosh, I think this function can be done someway. # def method_facebook_javascript_function(method, url = '', href = nil) # action = (href && url.size > 0) ? "'#{url}'" : 'this.getHref' # submit_function = # "var f = document.createElement('form'); f.setStyle('display','none'); " + # "this.getParentNode.appendChild(f); f.setMethod('POST'); f.setAction(#{action});" # # unless method == :post # submit_function << "var m = document.createElement('input'); m.setAttribute('type', 'hidden'); " # submit_function << "m.setAttribute('name', '_method'); m.setAttribute('value', '#{method}'); f.appendChild(m);" # end # # if protect_against_forgery? # submit_function << "var s = document.createElement('input'); s.setAttribute('type', 'hidden'); " # submit_function << "s.setAttribute('name', '#{request_forgery_protection_token}'); # s.setAttribute('value', '#{escape_javascript form_authenticity_token}'); f.appendChild(s);" # end # submit_function << " f.submit(); " # end ####### end end end end -------------- next part -------------- Index: test/rails_integration_test.rb =================================================================== --- test/rails_integration_test.rb (revision 224) +++ test/rails_integration_test.rb (working copy) @@ -6,6 +6,7 @@ require 'facebooker/rails/controller' require 'facebooker/rails/helpers' require 'facebooker/rails/facebook_form_builder' + require 'facebooker/rails/facebook_url_helper' require File.dirname(__FILE__)+'/../init' require 'mocha' @@ -806,4 +807,65 @@ end # rescue LoadError # $stderr.puts "Couldn't find action controller. That's OK. We'll skip it." -end \ No newline at end of file +end + +class RailsUrlHelperExtensionsTest < Test::Unit::TestCase + class UrlHelperExtensionsClass + include ActionView::Helpers::UrlHelper + include Facebooker::Rails::Helpers::UrlHelperExtensions + include ActionView::Helpers::TagHelper + def initialize + @template = self + end + + def protect_against_forgery? + false + end + end + + # used for capturing the contents of some of the helper tests + # this duplicates the rails template system + attr_accessor :_erbout + + def setup + @_erbout = "" + @u = UrlHelperExtensionsClass.new + @label = "Home Sweet Home" + @url = "www.home.com" + end + + def test_facebook_link_to + assert_equal @u.link_to(@label, at url), @u.facebook_link_to(@label, @url) + end + + def test_facebook_link_to_with_popup + assert_raises(ActionView::ActionViewError) {@u.facebook_link_to(@label, at url, :popup=>true)} + end + + def test_facebook_link_to_with_confirm + assert_equal "Visit Awesome Site", + @u.facebook_link_to("Visit Awesome Site", "http://facebooker.rubyforge.org/", :confirm => "Are you sure?") + end + + def test_facebook_link_to_with_method + assert_equal "
"+ + "" + + "
", @u.facebook_link_to("Delete without confirmation", "/images/9", :method => :delete) + end + + def test_facebook_link_to_with_confirm_and_method + assert_equal "
"+ + "
" + + ""+ + "Delete Image"+ + "
" + + "
", @u.facebook_link_to("Delete Image", "/images/9", :confirm => "Are you sure?", :method => :delete) + end +end + Index: init.rb =================================================================== --- init.rb (revision 224) +++ init.rb (working copy) @@ -19,6 +19,7 @@ require 'facebooker/rails/facebook_request_fix' require 'facebooker/rails/routing' require 'facebooker/rails/facebook_pretty_errors' rescue nil +require 'facebooker/rails/facebook_url_helper' module ::ActionController class Base def self.inherited_with_facebooker(subclass) @@ -26,6 +27,7 @@ if subclass.to_s == "ApplicationController" subclass.send(:include,Facebooker::Rails::Controller) subclass.helper Facebooker::Rails::Helpers + subclass.helper Facebooker::Rails::Helpers::UrlHelperExtensions end end class << self @@ -54,3 +56,7 @@ # pull :canvas=> into env in routing to allow for conditions ActionController::Routing::RouteSet.send :include, Facebooker::Rails::Routing::RouteSetExtensions ActionController::Routing::RouteSet::Mapper.send :include, Facebooker::Rails::Routing::MapperExtensions + +# for facebook_link_to, etc. +ActionView::Helpers::UrlHelper.send :include, Facebooker::Rails::Helpers::UrlHelperExtensions + From joseph.sofaer at gmail.com Thu Jun 19 14:16:12 2008 From: joseph.sofaer at gmail.com (Joseph Sofaer) Date: Thu, 19 Jun 2008 11:16:12 -0700 Subject: [Facebooker-talk] facebook apps developement "process" In-Reply-To: References: <83adaa130806190246r2578c09v7022cf7e1aeafb15@mail.gmail.com> Message-ID: <253bd1740806191116y1acf33cbp6de247a69dd2b012@mail.gmail.com> Aur?lien, Your other option is dynamic dns. So you can use a service like http://www.dyndns.com/services/dns/dyndns/ to get a url which they will route to you. You probably also have to set your router up to do port forwarding. So have port 3000 go to you computer's ip. Then you want a development app, a production app and likely a staging app. Best, Joseph On Thu, Jun 19, 2008 at 4:54 AM, Mike Mangino wrote: > Here's a shameless plug: > > Check out Tunnlr: http://tunnlr.com > > It makes the tunneling hack effortless. That's how we develop all of our > applications. > > Mike > > On Jun 19, 2008, at 5:46 AM, Aur?lien Malisart wrote: > >> Hi everybody. New to facebook plateform and at the moment giving a try to >> Facebooker. >> >> I've developed a simple test app just to see how it works, and I'm >> wondering how you organize your work and deployment process. >> >> 1) When you're developing. >> >> Do you commit/push with your favorite SCM tool each time you modify >> something just to see if it works or not (and debug)? >> Not very convenient... >> >> Or, do you use some tunneling-hack to send the requests to your local dev >> machine or something like this? >> >> 2) How do you deal with development/production apps? >> >> Do you register two apps on FB? I mean one for dev and one for production. >> And then switch between them? >> >> Thanks! >> >> aurels >> _______________________________________________ >> 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 aurelien.malisart at gmail.com Thu Jun 19 14:54:36 2008 From: aurelien.malisart at gmail.com (=?ISO-8859-1?Q?Aur=E9lien_Malisart?=) Date: Thu, 19 Jun 2008 20:54:36 +0200 Subject: [Facebooker-talk] facebook apps developement "process" In-Reply-To: <253bd1740806191116y1acf33cbp6de247a69dd2b012@mail.gmail.com> References: <83adaa130806190246r2578c09v7022cf7e1aeafb15@mail.gmail.com> <253bd1740806191116y1acf33cbp6de247a69dd2b012@mail.gmail.com> Message-ID: <83adaa130806191154g4b2276ay422cb506bc6dc921@mail.gmail.com> Hi. Thanks for these replies. Set the callback url to be http://localhost[:port]/ and the app will run off > your machine, avoiding the need to commit just to test. If youre using FBML > rather than iframe then localhost won't work ... you'll need to specify an > externally accessible IP I think. > > That setup would imply that yes you would probably want to register a > production and development (with the developer mode ticked) app on FB. > > HTH > So, yes I'm using FBL. Not possible to imply using localhost:port Here's a shameless plug: > > Check out Tunnlr: http://tunnlr.com > > It makes the tunneling hack effortless. That's how we develop all of our > applications. > > Mike Seems good by not free. I'm just a student... I have multiple apps setup Dev - Staging and Production... > > For development I use an SSH Tunnel... Although I used to poke a hole in my > firewall and do port forwarding to my dev box. That doesn't work when you > are at a coffee shop though. > Okay... On Thu, Jun 19, 2008 at 8:16 PM, Joseph Sofaer wrote: > Aur?lien, > Your other option is dynamic dns. > So you can use a service like > http://www.dyndns.com/services/dns/dyndns/ to get a url which they > will route to you. > You probably also have to set your router up to do port forwarding. So > have port 3000 go to you computer's ip. > Then you want a development app, a production app and likely a staging app. > Best, Yes it's a solution. But not very convenient if you often change of location. I've thought about synchronizing my dev app with rsync to my remote server for tests... -------------- next part -------------- An HTML attachment was scrubbed... URL: From digidigo at gmail.com Thu Jun 19 15:11:29 2008 From: digidigo at gmail.com (David Clements) Date: Thu, 19 Jun 2008 13:11:29 -0600 Subject: [Facebooker-talk] facebook apps developement "process" In-Reply-To: <83adaa130806191154g4b2276ay422cb506bc6dc921@mail.gmail.com> References: <83adaa130806190246r2578c09v7022cf7e1aeafb15@mail.gmail.com> <253bd1740806191116y1acf33cbp6de247a69dd2b012@mail.gmail.com> <83adaa130806191154g4b2276ay422cb506bc6dc921@mail.gmail.com> Message-ID: Didn't I hear about some project where you could run a mock facebook server locally? I am trying to remember. Anyone know what I am talking about? Dave On Thu, Jun 19, 2008 at 12:54 PM, Aur?lien Malisart < aurelien.malisart at gmail.com> wrote: > Hi. Thanks for these replies. > > Set the callback url to be http://localhost[:port]/ and the app will run >> off your machine, avoiding the need to commit just to test. If youre using >> FBML rather than iframe then localhost won't work ... you'll need to specify >> an externally accessible IP I think. >> >> That setup would imply that yes you would probably want to register a >> production and development (with the developer mode ticked) app on FB. >> >> HTH >> > > So, yes I'm using FBL. Not possible to imply using localhost:port > > Here's a shameless plug: >> >> Check out Tunnlr: http://tunnlr.com >> >> It makes the tunneling hack effortless. That's how we develop all of our >> applications. >> >> Mike > > > Seems good by not free. I'm just a student... > > I have multiple apps setup Dev - Staging and Production... >> >> For development I use an SSH Tunnel... Although I used to poke a hole in >> my firewall and do port forwarding to my dev box. That doesn't work when >> you are at a coffee shop though. >> > > Okay... > > On Thu, Jun 19, 2008 at 8:16 PM, Joseph Sofaer > wrote: > >> Aur?lien, >> Your other option is dynamic dns. >> So you can use a service like >> http://www.dyndns.com/services/dns/dyndns/ to get a url which they >> will route to you. >> You probably also have to set your router up to do port forwarding. So >> have port 3000 go to you computer's ip. >> Then you want a development app, a production app and likely a staging >> app. >> Best, > > > Yes it's a solution. But not very convenient if you often change of > location. > > > I've thought about synchronizing my dev app with rsync to my remote server > for tests... > > > _______________________________________________ > Facebooker-talk mailing list > Facebooker-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/facebooker-talk > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From joe at pinkpucker.net Fri Jun 20 17:35:58 2008 From: joe at pinkpucker.net (Joe Van Dyk) Date: Fri, 20 Jun 2008 14:35:58 -0700 Subject: [Facebooker-talk] Rails 2.1 + facebooker Message-ID: Heard that facebooker doesn't quite support Rails 2.1. How close is trunk to supporting it? Joe From joe at pinkpucker.net Fri Jun 20 21:41:17 2008 From: joe at pinkpucker.net (Joe Van Dyk) Date: Fri, 20 Jun 2008 18:41:17 -0700 Subject: [Facebooker-talk] new facebooker app is live Message-ID: http://apps.facebook.com/dailycaption we're still in "beta" mode, whatever that means. still lots of polishing. This is my first facebook app, and comments and criticisms are very much appreciated! Thanks, Joe From jordanr at cs.washington.edu Fri Jun 20 22:47:29 2008 From: jordanr at cs.washington.edu (Richard Jordan) Date: Fri, 20 Jun 2008 19:47:29 -0700 (PDT) Subject: [Facebooker-talk] [PATCH] complete facebook_url_helper In-Reply-To: References: Message-ID: I converted the rest of the functions in the Rails UrlHelper module to work with Facebooker. These are now: facebook_button_to, facebook_link_to_unless, facebook_link_to_if, facebook_link_to_unless_current, and facebook_current?. The first file is the updated diff with changes to the /init.rb file to load the new facebook_url_helper.rb file as well as extensive tests on all the facebook url helpers. The other file is the updated ruby file with the new helpers as well as some insignificant changes to facebook_link_to. If anyone has trouble, I'll try to point you in the right direction. Or if be it, I'd love to fix any bugs. Richard -------------- next part -------------- Index: test/rails_integration_test.rb =================================================================== --- test/rails_integration_test.rb (revision 224) +++ test/rails_integration_test.rb (working copy) @@ -6,6 +6,7 @@ require 'facebooker/rails/controller' require 'facebooker/rails/helpers' require 'facebooker/rails/facebook_form_builder' + require 'facebooker/rails/facebook_url_helper' require File.dirname(__FILE__)+'/../init' require 'mocha' @@ -806,4 +807,151 @@ end # rescue LoadError # $stderr.puts "Couldn't find action controller. That's OK. We'll skip it." -end \ No newline at end of file +end + +class RailsUrlHelperExtensionsTest < Test::Unit::TestCase + class UrlHelperExtensionsClass + include ActionView::Helpers::UrlHelper + include Facebooker::Rails::Helpers::UrlHelperExtensions + include ActionView::Helpers::TagHelper + def initialize(controller) + ENV['FACEBOOKER_RELATIVE_URL_ROOT'] ='facebook_app_name' + @controller = controller + end + + def protect_against_forgery? + false + end + end + class UrlHelperExtensionsController < NoisyController + def index + render :nothing => true + end + def do_it + render :nothing => true + end + end + + # We need to simulate an outside request to the callback server + # where the ENV['FACEBOOK_CANVAS_PATH] == ENV['FACEBOOKER_RELATIVE_URL_ROOT'] + # is ***not*** prepended to the request uri + # ex. apps.facebook.com/facebook_app_name/controller/action (prepended) + # test.host/controller/action (***not*** prepended) + class FacebookRequest < ActionController::TestRequest + # Parse the canvas name off to simulate a real request. + def request_uri + super.gsub(/^\/#{ENV['FACEBOOKER_RELATIVE_URL_ROOT']}(.*)/, '\1' ) + end + end + + def setup + ENV['FACEBOOK_CANVAS_PATH'] ='facebook_app_name' + @controller = UrlHelperExtensionsController.new + @request = FacebookRequest.new + @response = ActionController::TestResponse.new + + @current_page = "http://test.host/rails_url_helper_extensions_test/url_helper_extensions/do_it?fb_sig_in_canvas=1" + @not_current_page = "http://some.host/control/action" + + @u = UrlHelperExtensionsClass.new(@controller) + @label = "Home Sweet Home" + @url = "www.home.com" + end + + def test_facebook_link_to + assert_equal @u.link_to(@label, at url), @u.facebook_link_to(@label, @url) + end + + def test_facebook_link_to_with_popup + assert_raises(ActionView::ActionViewError) {@u.facebook_link_to(@label, at url, :popup=>true)} + end + + def test_facebook_link_to_with_confirm + assert_equal "Visit Awesome Site", + @u.facebook_link_to("Visit Awesome Site", "http://facebooker.rubyforge.org/", :confirm => "Are you sure?") + end + + # Watch out for the form id, adding new tests will change it. + def test_facebook_link_to_with_method + assert_equal "
"+ + "" + + "
", @u.facebook_link_to("Delete without confirmation", "/images/9", :method => :delete) + end + + # Watch out for the form id, adding new tests will change it. + def test_facebook_link_to_with_confirm_and_method + assert_equal "
"+ + "
" + + ""+ + "Delete Image"+ + "
" + + "
", @u.facebook_link_to("Delete Image", "/images/9", :confirm => "Are you sure?", :method => :delete) + end + + def test_facebook_button_to + assert_equal @u.button_to(@label, at url), @u.facebook_button_to(@label, @url) + end + + # Watch out for the form id, adding new tests will change it. + def test_facebook_button_to_with_confirm + assert_equal "
"+ + "
" + + ""+ + "
" + + "
", @u.facebook_button_to("Do it!", "/images/9", :confirm => "Are you sure?") + end + + def test_facebook_current_page_with_current_url_string + post :do_it, example_rails_params_including_fb + assert @u.facebook_current_page?(@current_page) + end + def test_facebook_current_page_with_non_current_url_string + post :do_it, example_rails_params_including_fb + assert !@u.facebook_current_page?(@not_current_page) + end + def test_facebook_current_page_with_current_url_hash + post :do_it, example_rails_params_including_fb + assert @u.facebook_current_page?(:action=>"do_it", :fb_sig_in_canvas=>"1") + end + def test_facebook_current_page_with_non_current_url_hash + post :do_it, example_rails_params_including_fb + assert !@u.facebook_current_page?(:action=>"not_action") + end + + def test_facebook_link_to_unless_with_true + assert_equal @label, @u.facebook_link_to_unless(true, at label, at url) + end + def test_facebook_link_to_unless_with_false + assert_equal @u.facebook_link_to(@label, at url, :confirm=>"What?"), @u.facebook_link_to_unless(false, at label, at url, :confirm=>"What?") + end + + def test_facebook_link_to_if_with_true + assert_equal @u.facebook_link_to(@label, at url, :confirm=>"What?"), @u.facebook_link_to_if(true, at label, at url, :confirm=>"What?") + end + def test_facebook_link_to_if_with_false + assert_equal @label, @u.facebook_link_to_if(false, at label, at url) + end + + def test_facebook_link_to_unless_current_with_current + post :do_it, example_rails_params_including_fb + assert_equal @label, @u.facebook_link_to_unless_current(@label,{:action=>"do_it", :fb_sig_in_canvas=>"1"}, :confirm=>"What?") + end + def test_facebook_link_to_unless_current_with_not_current + post :do_it, example_rails_params_including_fb + assert_equal @u.facebook_link_to(@label,{:action=>"index",:fb_sig_in_canvas=>"1"}, :confirm=>"What?"), + @u.facebook_link_to_unless_current(@label,{:action=>"index", :fb_sig_in_canvas=>"1"}, :confirm=>"What?") + end + + private + # Makes the canvas page be prepended for the current page tests + def example_rails_params_including_fb + {"fb_sig_in_canvas"=>"1"} + end +end Index: init.rb =================================================================== --- init.rb (revision 224) +++ init.rb (working copy) @@ -19,6 +19,7 @@ require 'facebooker/rails/facebook_request_fix' require 'facebooker/rails/routing' require 'facebooker/rails/facebook_pretty_errors' rescue nil +require 'facebooker/rails/facebook_url_helper' module ::ActionController class Base def self.inherited_with_facebooker(subclass) @@ -26,6 +27,7 @@ if subclass.to_s == "ApplicationController" subclass.send(:include,Facebooker::Rails::Controller) subclass.helper Facebooker::Rails::Helpers + subclass.helper Facebooker::Rails::Helpers::UrlHelperExtensions end end class << self @@ -54,3 +56,7 @@ # pull :canvas=> into env in routing to allow for conditions ActionController::Routing::RouteSet.send :include, Facebooker::Rails::Routing::RouteSetExtensions ActionController::Routing::RouteSet::Mapper.send :include, Facebooker::Rails::Routing::MapperExtensions + +# for facebook_link_to, etc. +ActionView::Helpers::UrlHelper.send :include, Facebooker::Rails::Helpers::UrlHelperExtensions + -------------- next part -------------- module Facebooker module Rails module Helpers module UrlHelperExtensions # Creates a link tag. If you do not pass any options, then it acts # exactly the same as link_to. See the documention there. # # Otherwise, it has some limitations because of # differences between JavaScript(JS) and Facebook Javascript(FBJS). # These include # * You cannot use :back to link to the referrer. # * You cannot use :popup to open a new window. # * You cannot use :href to specify the link location. # As FBJS and Facebooker evolves, these limitations may disapear or # be overcomed. # # ==== Options # * :confirm => 'question?' - This will add a Facebook Javascript # dialog with the question specified. If the user accepts, the link is # processed normally, otherwise no action is taken. # * :method => symbol of HTTP verb - This modifier will statically # create an HTML form and immediately submit the form for processing using # the HTTP verb specified. Unlike link_to, it mostly avoids Facebook # Javascript and instead wraps the link in an invisible form. Beware it # sets the form id to "_form"+ID_NUMBER+"_". Do not use such an id # elsewhere. # * The +html_options+ will accept a hash of html attributes for the link tag. # # ==== Examples # It conforms to Facebook Javascript unlike link_to. Specifically, link_to fails with # Facebook Javascript when using the :method and :confirm # options. Use as follows: # # facebook_link_to "Visit Awesome Site", "http://facebooker.rubyforge.org/", :confirm => "Are you sure?" # # => Visit Awesome Site # # facebook_link_to "Delete Image", @image, :confirm => "Are you sure?", :method => :delete # # =>
#
# # Delete Image #
#
# # facebook_link_to "Delete without confirmation", @image, :method => :delete # # =>
# #
def facebook_link_to(name, options = {}, fbml_options = nil) # maybe javascript is not needed, so just do the regular link_to return link_to(name,options,fbml_options) unless(fbml_options) fbml_options = fbml_options.stringify_keys return link_to(name,options,fbml_options) unless(javascript_needed?(fbml_options) ) url = options.is_a?(String) ? options : self.url_for(options) # save the method method = fbml_options['method'] convert_options_to_facebook_javascript!(fbml_options, url) tag_options = tag_options(fbml_options) link_tag = "#{name || url}" return link_tag unless method # fbjs is tricky so we will make a form to look like the link method_tag = '' if (%w{put delete}.include?(method.to_s) ) method_tag = tag('input', :type => 'hidden', :name => '_method', :value => method.to_s) end form_method = method.to_s == 'get' ? 'get' : 'post' request_token_tag = '' if form_method == 'post' && protect_against_forgery? request_token_tag = tag(:input, :type => "hidden", :name => request_forgery_protection_token.to_s, :value => form_authenticity_token) end "
" + method_tag + link_tag + request_token_tag + "
" end # Generates a form element containing a single button that submits # to the URL created by the set of +options+. All options are the same # as for the regular button_to. See the documentation of button_to. # # The only difference is :confirm. Because of Facebook Javascript(FBJS), # button_to silently fails for :confirm. Here it creates a FBJS dialog. # # To use CSS styling pass in :class. For example, the Facebook button # styling: (See http://wiki.developers.facebook.com/index.php/CSS_Tips_and_Tricks) # .inputbutton, # .inputsubmit { # padding: 2px 15px 3px 15px; # border-style: solid; # border-top-width: 1px; # border-left-width: 1px; # border-bottom-width: 1px; # border-right-width: 1px; # border-top-color: #D9DFEA; # border-left-color: #D9DFEA; # border-bottom-color: #0e1f5b; # border-right-color: #0e1f5b; # background-color: #3b5998; # color: #FFFFFF; # font-size: 11px; # font-family: "lucida grande", tahoma, verdana, arial, sans-serif; # text-align: center; } def facebook_button_to(name, options = {}, fbml_options = {}) fbml_options = fbml_options.stringify_keys return button_to(name,options,fbml_options) unless(fbml_options["confirm"]) convert_boolean_attributes!(fbml_options, %w( disabled )) method_tag = '' if (method = fbml_options.delete('method')) && %w{put delete}.include?(method.to_s) method_tag = tag('input', :type => 'hidden', :name => '_method', :value => method.to_s) end form_method = method.to_s == 'get' ? 'get' : 'post' request_token_tag = '' if form_method == 'post' && protect_against_forgery? request_token_tag = tag(:input, :type => "hidden", :name => request_forgery_protection_token.to_s, :value => form_authenticity_token) end url = options.is_a?(String) ? options : self.url_for(options) name ||= url form_id_attr = '' if confirm = fbml_options.delete("confirm") fbml_options["onclick"] = "#{confirm_facebook_javascript_function(confirm,url,nil,true)}" form_id_attr = "#{next_form_id_attr} " # add a space after it end fbml_options.merge!("type"=>"button") "
" + method_tag + content_tag("button", name, fbml_options) + request_token_tag + "
" end # Same as link_to_unless_current except it uses facebook_link_to and facebook_current?. def facebook_link_to_unless_current(name, options = {}, fbml_options = {}, &block) facebook_link_to_unless facebook_current_page?(options), name, options, fbml_options, &block end # Same as link_to_unless, except it uses facebook_link_to. def facebook_link_to_unless(condition, name, options = {}, fbml_options = {}, &block) if condition if block_given? block.arity <= 1 ? yield(name) : yield(name, options, fbml_options) else name end else facebook_link_to(name, options, fbml_options) end end # Same as link_to_if except it uses facebook_link_to. def facebook_link_to_if(condition, name, options = {}, fbml_options = {}, &block) facebook_link_to_unless !condition, name, options, fbml_options, &block end # True if the current request URI was generated by the given +options+. # Same as current_page? except for one very important fix. It adjusts # for the facebook canvas page name. # # ==== Example # Let's say we're in the /facebook_canvas_name/shop/checkout action. # The canvas page will ruin current_page? but here it adjusts. # # current_page?(:controller => 'shop', :action => 'checkout') # # => false # # facebook_current_page?(:controller => 'shop', :action => 'checkout') # # => true def facebook_current_page?(options) url_string = CGI.escapeHTML(url_for(options)).gsub(/^\/#{ENV["FACEBOOKER_RELATIVE_URL_ROOT"]}(.*)/, '\1' ) request = @controller.request if url_string =~ /^\w+:\/\// url_string == "#{request.protocol}#{request.host_with_port}#{request.request_uri}" else url_string == request.request_uri end end private # Makes sure the right form submits @@form_id=0 def form_id "_form#{@@form_id.to_s}_" end # Increments the form_id so we don't reuse it. # All our forms then will have a unique id. def next_form_id_attr form_id_attr = "id=\"#{form_id}\"" @@form_id = @@form_id + 1 form_id_attr end # Returns true when we must create an onclick tag. def javascript_needed?(fbml_options) (fbml_options["confirm"] || fbml_options["popup"] || fbml_options["method"]) end # Does not allow href or popup attributes. def convert_options_to_facebook_javascript!(fbml_options, url = '') confirm, popup = fbml_options.delete("confirm"), fbml_options.delete("popup") method, href = fbml_options.delete("method"), fbml_options['href'] fbml_options["onclick"] = case when href || popup raise ActionView::ActionViewError, "You can't use :href or :popup -- at least yet" when confirm "#{confirm_facebook_javascript_function(confirm, url, href, method)};" when method "#{method_submit}" else fbml_options["onclick"] end end def method_submit "document.getElementById('#{escape_javascript(form_id)}').submit(); return false;" end def change_location(url) "document.setLocation('#{escape_javascript(url)}'); return false;" end # Creates a facebook dialog. Changes the FBJS function based on whether a method was chosen. def confirm_facebook_javascript_function(confirm, url, href, method_defined=false) "new Dialog().showChoice('','#{escape_javascript(confirm)}').onconfirm = function() { #{method_defined ? method_submit : change_location(url)} }" end end end end end From jordanr at cs.washington.edu Sun Jun 22 21:14:19 2008 From: jordanr at cs.washington.edu (Richard Jordan) Date: Sun, 22 Jun 2008 18:14:19 -0700 (PDT) Subject: [Facebooker-talk] (no subject) Message-ID: Attached is a diff to fix facebook_form_for for Rails 2.1. It was crashing because of the new form authenticity token. I slipped in a line in helper.rb that adds in the token. I also stubbed protect_from_forgery? out in the rails_integration_test. Hope that helps, Richard -------------- next part -------------- Index: test/rails_integration_test.rb =================================================================== --- test/rails_integration_test.rb (revision 224) +++ test/rails_integration_test.rb (working copy) @@ -413,7 +413,9 @@ def fields_for(*args) "" end - + def protect_against_forgery? + false + end end # used for capturing the contents of some of the helper tests @@ -806,4 +808,4 @@ end # rescue LoadError # $stderr.puts "Couldn't find action controller. That's OK. We'll skip it." -end \ No newline at end of file +end Index: lib/facebooker/rails/helpers.rb =================================================================== --- lib/facebooker/rails/helpers.rb (revision 224) +++ lib/facebooker/rails/helpers.rb (working copy) @@ -179,6 +179,9 @@ concat(tag("fb:editor",editor_options,true) , proc.binding) concat(tag(:input,{:type=>"hidden",:name=>:_method, :value=>method},false), proc.binding) unless method.blank? + if(method !='get' && protect_against_forgery?) + concat(tag(:input,{:type=>"hidden",:name=> request_forgery_protection_token.to_s, :value=>form_authenticity_token},false),proc.binding) + end fields_for( object_name,*(args << options), &proc) concat("",proc.binding) end @@ -581,4 +584,4 @@ self[newkey] = self.delete(oldkey) if self.has_key?(oldkey) self end -end \ No newline at end of file +end From mmangino at elevatedrails.com Mon Jun 23 08:12:12 2008 From: mmangino at elevatedrails.com (Mike Mangino) Date: Mon, 23 Jun 2008 08:12:12 -0400 Subject: [Facebooker-talk] [PATCH] complete facebook_url_helper In-Reply-To: References: Message-ID: Would it be possible to make the normal version work? I hate having to use facebooker_button_to instead of just button_to. We did that with link_to_remote by just making the facebooker.js interface match prototype. Is that possible here too? If you can make it work transparently, I'll give you commit access to keep making these changes :) Mike On Jun 20, 2008, at 10:47 PM, Richard Jordan wrote: > I converted the rest of the functions in the Rails UrlHelper module > to work with Facebooker. These are now: facebook_button_to, > facebook_link_to_unless, facebook_link_to_if, > facebook_link_to_unless_current, and facebook_current?. The first > file is the updated diff with changes to the /init.rb file to load > the new facebook_url_helper.rb file as well as extensive tests on > all the facebook url helpers. The other file is the updated ruby > file with the new helpers as well as some insignificant changes to > facebook_link_to. > > If anyone has trouble, I'll try to point you in the right > direction. Or if be it, I'd love to fix any bugs. > > Richard > < > facebook_url_helper > .diff > > > < > facebook_url_helper.rb>_______________________________________________ > Facebooker-talk mailing list > Facebooker-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/facebooker-talk -- Mike Mangino http://www.elevatedrails.com From jordanr at cs.washington.edu Mon Jun 23 12:32:10 2008 From: jordanr at cs.washington.edu (Richard Jordan) Date: Mon, 23 Jun 2008 09:32:10 -0700 (PDT) Subject: [Facebooker-talk] [PATCH] complete facebook_url_helper In-Reply-To: References: Message-ID: Sure, all of these facebook_link_to, facebook_button_to, etc. could be just link_to, button_to, etc. I just call the regular link_to, button_to if none of the options passed require javascript. I'd love to make a few changes and get those to work transparently. I'll check out how you did the link_to_remote and see what I can do. Also, I've found a few other problems with my changes. It'd great if I could have commit access and make sure it all works perfectly. I'll be real careful and quick on any bugs, too. Awesome, Richard On Mon, 23 Jun 2008, Mike Mangino wrote: > Would it be possible to make the normal version work? I hate having to use > facebooker_button_to instead of just button_to. We did that with > link_to_remote by just making the facebooker.js interface match prototype. Is > that possible here too? If you can make it work transparently, I'll give you > commit access to keep making these changes :) > > Mike > > > On Jun 20, 2008, at 10:47 PM, Richard Jordan wrote: > >> I converted the rest of the functions in the Rails UrlHelper module to work >> with Facebooker. These are now: facebook_button_to, >> facebook_link_to_unless, facebook_link_to_if, >> facebook_link_to_unless_current, and facebook_current?. The first file is >> the updated diff with changes to the /init.rb file to load the new >> facebook_url_helper.rb file as well as extensive tests on all the facebook >> url helpers. The other file is the updated ruby file with the new helpers >> as well as some insignificant changes to facebook_link_to. >> >> If anyone has trouble, I'll try to point you in the right direction. Or if >> be it, I'd love to fix any bugs. >> >> Richard_______________________________________________ >> Facebooker-talk mailing list >> Facebooker-talk at rubyforge.org >> http://rubyforge.org/mailman/listinfo/facebooker-talk > > -- > Mike Mangino > http://www.elevatedrails.com > > > From bjclark at scidept.com Mon Jun 23 13:34:06 2008 From: bjclark at scidept.com (BJ Clark) Date: Mon, 23 Jun 2008 11:34:06 -0600 Subject: [Facebooker-talk] :canvas => false and redirecting back to facebook Message-ID: Hello List, Surely someone has done this before. I'm trying to use Attachment_fu for file uploads from facebook. I've figured out that you have to set :canvas => false to send the form back to your server directly, but I can't seem to redirect the user back to facebook after that. I'm using AR Store for cookies and I'm doing a redirect_to foo_bar_url(@foo) for the redirect. I always get an IncorrectSignature error. Anyone found a way around this? Maybe I should just do this all over ajax, then I don't need to worry about the redirect? Any thoughts/help is greatly appreciated! Thanks, BJ Clark From mmangino at elevatedrails.com Mon Jun 23 13:41:31 2008 From: mmangino at elevatedrails.com (Mike Mangino) Date: Mon, 23 Jun 2008 13:41:31 -0400 Subject: [Facebooker-talk] :canvas => false and redirecting back to facebook In-Reply-To: References: Message-ID: <85806C6E-F54C-4871-8E5B-BA44E3132935@elevatedrails.com> I think you need to add :canvas=>true on your redirect. Mike On Jun 23, 2008, at 1:34 PM, BJ Clark wrote: > Hello List, > Surely someone has done this before. > I'm trying to use Attachment_fu for file uploads from facebook. > I've figured out that you have to set :canvas => false to send the > form back to your server directly, but I can't seem to redirect the > user back to facebook after that. > > I'm using AR Store for cookies and I'm doing a redirect_to > foo_bar_url(@foo) for the redirect. > > I always get an IncorrectSignature error. > > Anyone found a way around this? > Maybe I should just do this all over ajax, then I don't need to > worry about the redirect? > > > Any thoughts/help is greatly appreciated! > > Thanks, > BJ Clark > _______________________________________________ > Facebooker-talk mailing list > Facebooker-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/facebooker-talk -- Mike Mangino http://www.elevatedrails.com From bjclark at scidept.com Mon Jun 23 14:10:33 2008 From: bjclark at scidept.com (BJ Clark) Date: Mon, 23 Jun 2008 12:10:33 -0600 Subject: [Facebooker-talk] [PATCH] complete facebook_url_helper In-Reply-To: References: Message-ID: Richard (and those interested), We've also began to re-impliment lots of the prototype helpers in FBJS. Mostly for simple toggling, adding class names, etc. and ajax forms. We'll be committing this back to Facebooker in the near future, but can't do it right now. Maybe we can put our .js file on github for the time being if there's interest in collaborating on this from anyone else? BJ Clark On Jun 23, 2008, at 10:32 AM, Richard Jordan wrote: > Sure, all of these facebook_link_to, facebook_button_to, etc. could > be just link_to, button_to, etc. I just call the regular link_to, > button_to if none of the options passed require javascript. I'd > love to make a few changes and get those to work transparently. > I'll check out how you did the link_to_remote and see what I can do. > > Also, I've found a few other problems with my changes. It'd great > if I could have commit access and make sure it all works perfectly. > I'll be real careful and quick on any bugs, too. > > Awesome, > Richard > > > On Mon, 23 Jun 2008, Mike Mangino wrote: > >> Would it be possible to make the normal version work? I hate having >> to use facebooker_button_to instead of just button_to. We did that >> with link_to_remote by just making the facebooker.js interface >> match prototype. Is that possible here too? If you can make it work >> transparently, I'll give you commit access to keep making these >> changes :) >> >> Mike >> >> >> On Jun 20, 2008, at 10:47 PM, Richard Jordan wrote: >> >>> I converted the rest of the functions in the Rails UrlHelper >>> module to work with Facebooker. These are now: >>> facebook_button_to, facebook_link_to_unless, facebook_link_to_if, >>> facebook_link_to_unless_current, and facebook_current?. The first >>> file is the updated diff with changes to the /init.rb file to load >>> the new facebook_url_helper.rb file as well as extensive tests on >>> all the facebook url helpers. The other file is the updated ruby >>> file with the new helpers as well as some insignificant changes to >>> facebook_link_to. >>> If anyone has trouble, I'll try to point you in the right >>> direction. Or if be it, I'd love to fix any bugs. >>> Richard >>> < >>> facebook_url_helper >>> .diff >>> > >>> < >>> facebook_url_helper >>> .rb>_______________________________________________ >>> 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 mmangino at elevatedrails.com Mon Jun 23 14:15:48 2008 From: mmangino at elevatedrails.com (Mike Mangino) Date: Mon, 23 Jun 2008 14:15:48 -0400 Subject: [Facebooker-talk] [PATCH] complete facebook_url_helper In-Reply-To: References: Message-ID: <8D6FB187-3A10-4805-9C95-DA8FDE4F7512@elevatedrails.com> That would be great! I'm open to using github for Facebooker as well. Mike On Jun 23, 2008, at 2:10 PM, BJ Clark wrote: > Richard (and those interested), > > We've also began to re-impliment lots of the prototype helpers in > FBJS. > Mostly for simple toggling, adding class names, etc. and ajax forms. > We'll be committing this back to Facebooker in the near future, but > can't do it right now. > Maybe we can put our .js file on github for the time being if > there's interest in collaborating on this from anyone else? > > BJ Clark > > > > On Jun 23, 2008, at 10:32 AM, Richard Jordan wrote: > >> Sure, all of these facebook_link_to, facebook_button_to, etc. could >> be just link_to, button_to, etc. I just call the regular link_to, >> button_to if none of the options passed require javascript. I'd >> love to make a few changes and get those to work transparently. >> I'll check out how you did the link_to_remote and see what I can do. >> >> Also, I've found a few other problems with my changes. It'd great >> if I could have commit access and make sure it all works >> perfectly. I'll be real careful and quick on any bugs, too. >> >> Awesome, >> Richard >> >> >> On Mon, 23 Jun 2008, Mike Mangino wrote: >> >>> Would it be possible to make the normal version work? I hate >>> having to use facebooker_button_to instead of just button_to. We >>> did that with link_to_remote by just making the facebooker.js >>> interface match prototype. Is that possible here too? If you can >>> make it work transparently, I'll give you commit access to keep >>> making these changes :) >>> >>> Mike >>> >>> >>> On Jun 20, 2008, at 10:47 PM, Richard Jordan wrote: >>> >>>> I converted the rest of the functions in the Rails UrlHelper >>>> module to work with Facebooker. These are now: >>>> facebook_button_to, facebook_link_to_unless, facebook_link_to_if, >>>> facebook_link_to_unless_current, and facebook_current?. The >>>> first file is the updated diff with changes to the /init.rb file >>>> to load the new facebook_url_helper.rb file as well as extensive >>>> tests on all the facebook url helpers. The other file is the >>>> updated ruby file with the new helpers as well as some >>>> insignificant changes to facebook_link_to. >>>> If anyone has trouble, I'll try to point you in the right >>>> direction. Or if be it, I'd love to fix any bugs. >>>> Richard >>>> < >>>> facebook_url_helper >>>> .diff >>>> > >>>> < >>>> facebook_url_helper >>>> .rb>_______________________________________________ >>>> 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 > > _______________________________________________ > Facebooker-talk mailing list > Facebooker-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/facebooker-talk -- Mike Mangino http://www.elevatedrails.com From aurelien.malisart at gmail.com Mon Jun 23 14:31:23 2008 From: aurelien.malisart at gmail.com (=?ISO-8859-1?Q?Aur=E9lien_Malisart?=) Date: Mon, 23 Jun 2008 20:31:23 +0200 Subject: [Facebooker-talk] [PATCH] complete facebook_url_helper In-Reply-To: <8D6FB187-3A10-4805-9C95-DA8FDE4F7512@elevatedrails.com> References: <8D6FB187-3A10-4805-9C95-DA8FDE4F7512@elevatedrails.com> Message-ID: <83adaa130806231131i13f3d221q1ddec7f10f05c7bf@mail.gmail.com> Since all the rails community is switching to Git, I think it's a good idea... aurels -------------- next part -------------- An HTML attachment was scrubbed... URL: From digidigo at gmail.com Tue Jun 24 08:52:43 2008 From: digidigo at gmail.com (David Clements) Date: Tue, 24 Jun 2008 06:52:43 -0600 Subject: [Facebooker-talk] Facebooker Application Gallery Message-ID: Hey All, I created a gallery page on the Facebooker Tutorial. If you have an app built on Facebooker and would like to add it to the gallery you can go here: http://apps.facebook.com/facebooker_tutorial/facebooker_apps/new I will make sure that the links work and then approve it. Once approved it will show up on the page for all to see! I think it will be cool to see what apps are out there. Thanks and shoot me an email directly if you have any trouble as the gallery is just scaffolded right now, Dave -------------- next part -------------- An HTML attachment was scrubbed... URL: From bjclark at scidept.com Tue Jun 24 14:45:29 2008 From: bjclark at scidept.com (BJ Clark) Date: Tue, 24 Jun 2008 12:45:29 -0600 Subject: [Facebooker-talk] Facebooker and Rails 2.1 Message-ID: <7D6626A9-8569-4707-BF60-E110648AA071@scidept.com> Hello, Has anyone been working on making Facebooker play nice with Rails 2.1? Is there a list anywhere of the current issues? Our only known issue is with the Publisher stuff and Templates. We get the following error: ActionView::TemplateFinder::InvalidViewPath (Unprocessed view path found: "/xxxxxxx/xxxxxx/app/views/". Set your view paths with #append_view_path, #prepend_view_path, or #view_paths=.): Full trace here: http://pastie.org/216283 Does anyone have a fix for this, or know where to start? Is there any where that we could track the issues with 2.1 so we can all work on getting Facebooker working properly? Thanks, BJ Clark Inigral From jordanr at cs.washington.edu Tue Jun 24 16:51:34 2008 From: jordanr at cs.washington.edu (Richard Jordan) Date: Tue, 24 Jun 2008 13:51:34 -0700 (PDT) Subject: [Facebooker-talk] Facebooker and Rails 2.1 In-Reply-To: <7D6626A9-8569-4707-BF60-E110648AA071@scidept.com> References: <7D6626A9-8569-4707-BF60-E110648AA071@scidept.com> Message-ID: I've seen: 1. the InvalidViewPath error you mention - I haven't really looked into it, yet. I thought you, BJ, solved it by updating? But, I guess not. Maybe, I'll look into it sometime this week. 2. form authenticity tokens - Forms need authenticity tokens now which I don't remember having to do before? So, facebook_form_for seems broken. I submitted a very simple diff that adds a token in. I've been running Rails 2.1 and just seeing what I bump into. Richard On Tue, 24 Jun 2008, BJ Clark wrote: > Hello, > Has anyone been working on making Facebooker play nice with Rails 2.1? > Is there a list anywhere of the current issues? > > Our only known issue is with the Publisher stuff and Templates. We get the > following error: > ActionView::TemplateFinder::InvalidViewPath (Unprocessed view path found: > "/xxxxxxx/xxxxxx/app/views/". Set your view paths with #append_view_path, > #prepend_view_path, or #view_paths=.): > > Full trace here: > http://pastie.org/216283 > > > Does anyone have a fix for this, or know where to start? > Is there any where that we could track the issues with 2.1 so we can all work > on getting Facebooker working properly? > > Thanks, > BJ Clark > Inigral > _______________________________________________ > Facebooker-talk mailing list > Facebooker-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/facebooker-talk > From charlesdeb at hotmail.com Tue Jun 24 17:17:31 2008 From: charlesdeb at hotmail.com (Charles de Bueger) Date: Wed, 25 Jun 2008 00:17:31 +0300 Subject: [Facebooker-talk] Controller Tests Message-ID: dear folks, just wondering if anyone knows the trick for doing controller tests with facebooker. I have ensured that my facebooker.yml is setup for tests (I have put in the same information as I use for my development environment which works fine), and my unit tests are fine. however, when I run my controller tests (that used to work fine before I facebook'ised my app), I get errors like this in my test.log: Processing CurrenciesController#create (for 0.0.0.0 at 2008-06-25 00:04:24) [POST] Session ID: Parameters: {"action"=>"create", "controller"=>"currencies", "currency"=>{"currency_code"=>"GBP", "currency"=>"pounds"}} Redirected to http://www.facebook.com/install.php?api_key=1234123412341234&v=1.0 Filter chain halted as [#] rendered_or_redirected. Completed in 0.00010 (10000 reqs/sec) | DB: 0.00000 (0%) | 302 Found [http://test.host/my_app/currencies/create?currency%5Bcurrency%5D=pounds¤cy%5Bcurrency_code%5D=GBP&format=fbml] It looks like the test is trying to route via FaceBook and failing. I notice that it is trying to send the request to http://test.host/my_app. What is this "test.host" that I see is mentioned in the FaceBooker code? I'm sure there is a simple fix to this, but Mr. Google has not given it to me... cheers, Charles de B From snoodger4eva at yahoo.com Wed Jun 25 07:03:10 2008 From: snoodger4eva at yahoo.com (Jon) Date: Wed, 25 Jun 2008 04:03:10 -0700 Subject: [Facebooker-talk] Facebook api and will paginate Message-ID: Hi all, I'm trying to use the Facebook api to get a list of the installed user's friends. I'd like to paginate that list and only show a certain number of friends at a time. I was thinking I'd use will_paginate for that. So there are two problems: first, how do you limit the number of friends that Facebook api sends you and only show a specific number of a user's total friends? Second, how do you integrate that with will_paginate? Before I dive head first into solving this, I'd thought I'd ask if any of you have solved these questions before. Cheers, -Jon -------------- next part -------------- An HTML attachment was scrubbed... URL: From joe at pinkpucker.net Wed Jun 25 19:07:34 2008 From: joe at pinkpucker.net (Joe Van Dyk) Date: Wed, 25 Jun 2008 16:07:34 -0700 Subject: [Facebooker-talk] Avoiding remote API calls inside controller actions Message-ID: So, it's bad to do network API calls to FB inside a controller action, amirite? If I want to display the user's first name though, how do I do that without making a FB API call? How about the user's friends that have the application installed? I only have 2 mongrels running and I hate to have them both tied up with Facebook API calls. From mniessner at elevatedrails.com Wed Jun 25 19:37:10 2008 From: mniessner at elevatedrails.com (Michael Niessner) Date: Wed, 25 Jun 2008 18:37:10 -0500 Subject: [Facebooker-talk] Avoiding remote API calls inside controller actions In-Reply-To: References: Message-ID: <410E021B-56FB-47C5-96AE-BFF72B47C8E3@gmail.com> You can use preload fql to get that information. Michael On Jun 25, 2008, at 6:07 PM, Joe Van Dyk wrote: > So, it's bad to do network API calls to FB inside a controller > action, amirite? > > If I want to display the user's first name though, how do I do that > without making a FB API call? How about the user's friends that have > the application installed? > > I only have 2 mongrels running and I hate to have them both tied up > with Facebook API calls. > _______________________________________________ > Facebooker-talk mailing list > Facebooker-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/facebooker-talk From jordanr at cs.washington.edu Wed Jun 25 20:09:12 2008 From: jordanr at cs.washington.edu (Richard Jordan) Date: Wed, 25 Jun 2008 17:09:12 -0700 (PDT) Subject: [Facebooker-talk] [PATCH] facebook_url_helper.rb v.2 In-Reply-To: References: Message-ID: Attached is a new version of facebook_url_helper in pristine fbjs. I guarantee no one can write any better. Here is a summary. 1. First, I looked into prototype, but the Rais UrlHelper module does not use prototype. link_to, button_to, current_page?, etc. do not use the prototype.js file. You don't have to include any javascript file. So, I couldn't mimic prototype.js. Sorry Mike, I see you keep asking for patches for it. 2. So, second, I thought I might just mimic js, but it turns out you cannot extend DOM objects in fbjs. I wanted to not touch UrlHelper at all like you did with link_to_remote. Wow, that is beautiful. But, you cannot in fbjs extend the DOM and do, for ex., Object.prototype.href = this.getHref(). I tried it and know so. Also, I have some vague proof from the FB wiki: >"You aren't allowed to extend base objects like Function or Array ..." >"FBJS objects don't contain handles to any of their actual DOM objects," So, it is impossible to mimic js with fbjs. You cannot just have UrlHelper do js and convert it to fbjs behind its back by adding to facebooker.js. 3. That leaves you one last option -- edit UrlHelper itself. So, I went back to the beginning and rewrote facebook_url_helper to transparently change link_to, button_to, etc. That simplified the code tremendously. I didn't even have to touch link_to directly! I changed one darn line in button_to. Also, I had some real brilliant breakthroughs with fbjs. So, the only way facebooker can support link_to, button_to, etc. is with the attached code. See what you think. Richard On Mon, 23 Jun 2008, Mike Mangino wrote: > Would it be possible to make the normal version work? I hate having to use > facebooker_button_to instead of just button_to. We did that with > link_to_remote by just making the facebooker.js interface match prototype. Is > that possible here too? If you can make it work transparently, I'll give you > commit access to keep making these changes :) > > Mike > -------------- next part -------------- module Facebooker module Rails module Helpers module UrlHelperExtensions # Adjusted to be the same as the regular button_to. def button_to(name, options = {}, html_options = {}) html_options = html_options.stringify_keys convert_boolean_attributes!(html_options, %w( disabled )) method_tag = '' if (method = html_options.delete('method')) && %w{put delete}.include?(method.to_s) method_tag = tag('input', :type => 'hidden', :name => '_method', :value => method.to_s) end form_method = method.to_s == 'get' ? 'get' : 'post' request_token_tag = '' if form_method == 'post' && protect_against_forgery? request_token_tag = tag(:input, :type => "hidden", :name => request_forgery_protection_token.to_s, :value => form_authenticity_token) end if confirm = html_options.delete("confirm") # this line is the only change => html_options["onclick"] = "return #{confirm_javascript_function(confirm)}" html_options["onclick"] = "#{confirm_javascript_function(confirm, 'a.getParentNode().getParentNode().submit();')}return false;" end url = options.is_a?(String) ? options : self.url_for(options) name ||= url html_options.merge!("type" => "submit", "value" => name) "
" + method_tag + tag("input", html_options) + request_token_tag + "
" end # Adjusted to be the same as the regular current_page? def current_page?(options) # this line is the only change => url_string = CGI.escapeHTML(url_for(options)) url_string = CGI.escapeHTML(url_for(options)).gsub(/^\/#{ENV["FACEBOOKER_RELATIVE_URL_ROOT"]}(.*)/, '\1' ) request = @controller.request if url_string =~ /^\w+:\/\// url_string == "#{request.protocol}#{request.host_with_port}#{request.request_uri}" else url_string == request.request_uri end end private # Overrides a private method that link_to calls. Now, we don't have to change link_to at all! def convert_options_to_javascript!(html_options, url = '') confirm, popup = html_options.delete("confirm"), html_options.delete("popup") method, href = html_options.delete("method"), html_options['href'] html_options["onclick"] = case when popup raise ActionView::ActionViewError, "You can't use :popup" when method # or maybe (confirm and method) "#{method_javascript_function(method, url, href, confirm)}return false;" when confirm # and only confirm "#{confirm_javascript_function(confirm)}return false;" else html_options["onclick"] end end # Overrides a private method that link_to calls via convert_options_to_javascript! and # also, button_to calls directly. def confirm_javascript_function(confirm, fun = nil) "var dlg = new Dialog().showChoice('Confirm Request','#{escape_javascript(confirm)}');var a=this;" + "dlg.onconfirm = function() { #{fun ? fun : 'document.setLocation(a.getHref());'} };" end # Called by confirm_javascript_function if and only if link_to has :method defined. def method_javascript_function(method, url = '', href = nil, confirm = nil) action = (href && url.size > 0) ? "'#{url}'" : 'a.getHref()' submit_function = "var f = document.createElement('form'); f.setStyle('display','none'); " + "a.getParentNode().appendChild(f); f.setMethod('POST'); f.setAction(#{action});" unless method == :post submit_function << "var m = document.createElement('input'); m.setType('hidden'); " submit_function << "m.setName('_method'); m.setValue('#{method}'); f.appendChild(m);" end if protect_against_forgery? submit_function << "var s = document.createElement('input'); s.setType('hidden'); " submit_function << "s.setName('#{request_forgery_protection_token}'); s.setValue('#{escape_javascript form_authenticity_token}'); f.appendChild(s);" end submit_function << "f.submit();" if(confirm) confirm_javascript_function(confirm, submit_function) else "var a=this;" + submit_function end end end end end end -------------- next part -------------- Index: test/rails_integration_test.rb =================================================================== --- test/rails_integration_test.rb (revision 225) +++ test/rails_integration_test.rb (working copy) @@ -6,6 +6,7 @@ require 'facebooker/rails/controller' require 'facebooker/rails/helpers' require 'facebooker/rails/facebook_form_builder' + require 'facebooker/rails/facebook_url_helper' require File.dirname(__FILE__)+'/../init' require 'mocha' @@ -811,6 +812,149 @@ assert_equal "", at form_builder.multi_friend_input end end + +class RailsUrlHelperExtensionsTest < Test::Unit::TestCase + class UrlHelperExtensionsClass + include ActionView::Helpers::UrlHelper + include Facebooker::Rails::Helpers::UrlHelperExtensions + include ActionView::Helpers::TagHelper + def initialize(controller) + ENV['FACEBOOKER_RELATIVE_URL_ROOT'] ='facebook_app_name' + @controller = controller + end + + def protect_against_forgery? + false + end + end + class UrlHelperExtensionsController < NoisyController + def index + render :nothing => true + end + def do_it + render :nothing => true + end + end + + # We need to simulate an outside request to the callback server + # where the ENV['FACEBOOK_CANVAS_PATH] == ENV['FACEBOOKER_RELATIVE_URL_ROOT'] + # is ***not*** prepended to the request uri + # ex. apps.facebook.com/facebook_app_name/controller/action (prepended) + # test.host/controller/action (***not*** prepended) + class FacebookRequest < ActionController::TestRequest + # Parse the canvas name off to simulate a real request. + def request_uri + super.gsub(/^\/#{ENV['FACEBOOKER_RELATIVE_URL_ROOT']}(.*)/, '\1' ) + end + end + + def setup + ENV['FACEBOOK_CANVAS_PATH'] ='facebook_app_name' + @controller = UrlHelperExtensionsController.new + @request = FacebookRequest.new + @response = ActionController::TestResponse.new + + @current_page = "http://test.host/rails_url_helper_extensions_test/url_helper_extensions/do_it?fb_sig_in_canvas=1" + @not_current_page = "http://some.host/control/action" + + @u = UrlHelperExtensionsClass.new(@controller) + @label = "Testing" + @url = "test.host" + end + + def test_link_to + assert_equal "Testing", @u.link_to(@label, @url) + end + + def test_link_to_with_popup + assert_raises(ActionView::ActionViewError) {@u.link_to(@label, at url, :popup=>true)} + end + + def test_link_to_with_confirm + assert_dom_equal( "#{@label}", + @u.link_to(@label, @url, :confirm => "Are you sure?") ) + end + + def test_link_to_with_method + assert_dom_equal( "#{@label}", @u.link_to(@label, at url, :method=>:delete)) + end + + def test_link_to_with_confirm_and_method + assert_dom_equal( "#{@label}", @u.link_to(@label, at url, :confirm=>'Are you sure?', :method=>:delete) ) + end + + def test_button_to + assert_equal "
" + + "
", @u.button_to(@label, at url) + end + + def test_button_to_with_confirm + assert_equal "
" + + "
", + @u.button_to(@label, at url, :confirm=>"Are you sure?") + end + def test_current_page_with_current_url_string + post :do_it, example_rails_params_including_fb + assert @u.current_page?(@current_page) + end + def test_current_page_with_non_current_url_string + post :do_it, example_rails_params_including_fb + assert !@u.current_page?(@not_current_page) + end + def test_current_page_with_current_url_hash + post :do_it, example_rails_params_including_fb + assert @u.current_page?(:action=>"do_it", :fb_sig_in_canvas=>"1") + end + def test_current_page_with_non_current_url_hash + post :do_it, example_rails_params_including_fb + assert !@u.current_page?(:action=>"not_action") + end + + def test_link_to_unless_with_true + assert_equal @label, @u.link_to_unless(true, at label, at url) + end + def test_link_to_unless_with_false + assert_equal @u.link_to(@label, at url), @u.link_to_unless(false, at label, at url) + end + + def test_link_to_if_with_true + assert_equal @u.link_to(@label, at url), @u.link_to_if(true, at label, at url) + end + def test_link_to_if_with_false + assert_equal @label, @u.link_to_if(false, at label, at url) + end + + def test_link_to_unless_current_with_current + post :do_it, example_rails_params_including_fb + assert_equal @label, @u.link_to_unless_current(@label,{:action=>"do_it", :fb_sig_in_canvas=>"1"}) + end + def test_link_to_unless_current_with_not_current + post :do_it, example_rails_params_including_fb + assert_equal @u.link_to(@label,{:action=>"index",:fb_sig_in_canvas=>"1"}), + @u.link_to_unless_current(@label,{:action=>"index", :fb_sig_in_canvas=>"1"}) + end + + private + # Makes the canvas page be prepended for the current page tests + def example_rails_params_including_fb + {"fb_sig_in_canvas"=>"1"} + end +end + # rescue LoadError # $stderr.puts "Couldn't find action controller. That's OK. We'll skip it." end Index: init.rb =================================================================== --- init.rb (revision 225) +++ init.rb (working copy) @@ -19,6 +19,8 @@ require 'facebooker/rails/facebook_request_fix' require 'facebooker/rails/routing' require 'facebooker/rails/facebook_pretty_errors' rescue nil +require 'facebooker/rails/facebook_url_helper' +require 'facebooker/rails/helpers' module ::ActionController class Base def self.inherited_with_facebooker(subclass) @@ -26,6 +28,7 @@ if subclass.to_s == "ApplicationController" subclass.send(:include,Facebooker::Rails::Controller) subclass.helper Facebooker::Rails::Helpers + subclass.helper Facebooker::Rails::Helpers::UrlHelperExtensions end end class << self Index: lib/facebooker/models/user.rb =================================================================== --- lib/facebooker/models/user.rb (revision 225) +++ lib/facebooker/models/user.rb (working copy) @@ -211,7 +211,7 @@ @profile_info ||= @session.post('facebook.profile.getInfo', :uid => self.id) do |section| InfoSection.from_hash(section) end - + end ## # Set the status of the user # From bjclark at scidept.com Wed Jun 25 20:18:58 2008 From: bjclark at scidept.com (BJ Clark) Date: Wed, 25 Jun 2008 18:18:58 -0600 Subject: [Facebooker-talk] Avoiding remote API calls inside controller actions In-Reply-To: <410E021B-56FB-47C5-96AE-BFF72B47C8E3@gmail.com> References: <410E021B-56FB-47C5-96AE-BFF72B47C8E3@gmail.com> Message-ID: The easiest way is to use fbml. or the facebooker helper equiv of fb_name(uid). Obviously won't work if your not doing a canvas page app, though. Some people, who shall not be named, "cache" basic stuff like that in their database, that they use throughout their app, when a user signs up. This is, of course, against TOS however. BJ Clark Inigral On Jun 25, 2008, at 5:37 PM, Michael Niessner wrote: > You can use preload fql to get that information. > > Michael > > On Jun 25, 2008, at 6:07 PM, Joe Van Dyk wrote: > >> So, it's bad to do network API calls to FB inside a controller >> action, amirite? >> >> If I want to display the user's first name though, how do I do that >> without making a FB API call? How about the user's friends that have >> the application installed? >> >> I only have 2 mongrels running and I hate to have them both tied up >> with Facebook API calls. >> _______________________________________________ >> 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 ben at bensinclair.com Thu Jun 26 09:42:00 2008 From: ben at bensinclair.com (Ben Sinclair) Date: Thu, 26 Jun 2008 08:42:00 -0500 Subject: [Facebooker-talk] Avoiding remote API calls inside controller actions In-Reply-To: References: <410E021B-56FB-47C5-96AE-BFF72B47C8E3@gmail.com> Message-ID: <623748070806260642k35cac182w81e9de46978c20c@mail.gmail.com> If want to do some caching, you can hold onto their data for 24 hours (TOS section 2.A.4): "You may not continue to use, and must immediately remove from any Facebook Platform Application and any Data Repository in your possession or under your control, any Facebook Properties not explicitly identified as being storable indefinitely in the Facebook Platform Documentation within 24 hours after the time at which you obtained the data, or such other time as Facebook may specify to you from time to time." And if the user opts-in, you can hold onto their data indefinitely (TOS section 2.A.6): "You may retain copies of Exportable Facebook Properties for such period of time (if any) as the Applicable Facebook User for such Exportable Facebook Properties may approve, if (and only if) such Applicable Facebook user expressly approves your doing so pursuant to an affirmative "opt-in" after receiving a prominent disclosure of a) the uses you intend to make of such Exportable Facebook Properties, b) the duration for which you will retain copies of such Exportable Facebook Properties, and c) any terms and conditions governing your use of such Exportable Facebook Properties (a "Full Disclosure Opt-In"). On Wed, Jun 25, 2008 at 7:18 PM, BJ Clark wrote: > The easiest way is to use fbml. or the > facebooker helper equiv of fb_name(uid). Obviously won't work if your not > doing a canvas page app, though. > > Some people, who shall not be named, "cache" basic stuff like that in their > database, that they use throughout their app, when a user signs up. This is, > of course, against TOS however. > > BJ Clark > Inigral > > > On Jun 25, 2008, at 5:37 PM, Michael Niessner wrote: > >> You can use preload fql to get that information. >> >> Michael >> >> On Jun 25, 2008, at 6:07 PM, Joe Van Dyk wrote: >> >>> So, it's bad to do network API calls to FB inside a controller action, >>> amirite? >>> >>> If I want to display the user's first name though, how do I do that >>> without making a FB API call? How about the user's friends that have >>> the application installed? >>> >>> I only have 2 mongrels running and I hate to have them both tied up >>> with Facebook API calls. >>> _______________________________________________ >>> 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 > > _______________________________________________ > Facebooker-talk mailing list > Facebooker-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/facebooker-talk > -- Ben Sinclair ben at bensinclair.com From redinger at gmail.com Thu Jun 26 14:28:01 2008 From: redinger at gmail.com (Christopher Redinger) Date: Thu, 26 Jun 2008 14:28:01 -0400 Subject: [Facebooker-talk] GitHub? Message-ID: <681d4e8f0806261128q3d81e956p46f6353bc6f36bdf@mail.gmail.com> Any chance of making the jump to GitHub to make contributing easier? I've already got my fork over there, but it would be nicer to have the official repo there instead. -- Christopher Redinger http://www.agiledisciple.com From mmangino at elevatedrails.com Thu Jun 26 14:36:25 2008 From: mmangino at elevatedrails.com (Mike Mangino) Date: Thu, 26 Jun 2008 14:36:25 -0400 Subject: [Facebooker-talk] GitHub? In-Reply-To: <681d4e8f0806261128q3d81e956p46f6353bc6f36bdf@mail.gmail.com> References: <681d4e8f0806261128q3d81e956p46f6353bc6f36bdf@mail.gmail.com> Message-ID: <037D641E-F3F5-4DBA-9618-15E8736D8ED7@elevatedrails.com> I guess I should announce that I added Facebooker to GitHub yesterday. For now, I think my repo there should be the official one. I'm going to spend a little time over the next couple weeks moving to make facebooker work with Rails 2.1 and via a gem plugin. Mike On Jun 26, 2008, at 2:28 PM, Christopher Redinger wrote: > Any chance of making the jump to GitHub to make contributing easier? > I've already got my fork over there, but it would be nicer to have the > official repo there instead. > > -- > Christopher Redinger > http://www.agiledisciple.com > _______________________________________________ > Facebooker-talk mailing list > Facebooker-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/facebooker-talk -- Mike Mangino http://www.elevatedrails.com From redinger at gmail.com Thu Jun 26 14:45:51 2008 From: redinger at gmail.com (Christopher Redinger) Date: Thu, 26 Jun 2008 14:45:51 -0400 Subject: [Facebooker-talk] GitHub? In-Reply-To: <037D641E-F3F5-4DBA-9618-15E8736D8ED7@elevatedrails.com> References: <681d4e8f0806261128q3d81e956p46f6353bc6f36bdf@mail.gmail.com> <037D641E-F3F5-4DBA-9618-15E8736D8ED7@elevatedrails.com> Message-ID: <681d4e8f0806261145l3343cc99h8918641ac926ca4d@mail.gmail.com> Fantastic, thanks! Are you keeping a list of stuff that needs to be worked on for Rails 2.1? Since I am using 2.1 and Facebooker in a production app now, I'd be more than happy to contribute. Similar question for the changes to Facebook with regards to sessions. For instance sessions will no longer be needed for updating profiles, but the facebooker code uses a session to do so. Is there a plan for rewriting that kind of thing? On Thu, Jun 26, 2008 at 2:36 PM, Mike Mangino wrote: > I guess I should announce that I added Facebooker to GitHub yesterday. For > now, I think my repo there should be the official one. I'm going to spend a > little time over the next couple weeks moving to make facebooker work with > Rails 2.1 and via a gem plugin. > > Mike > > On Jun 26, 2008, at 2:28 PM, Christopher Redinger wrote: > >> Any chance of making the jump to GitHub to make contributing easier? >> I've already got my fork over there, but it would be nicer to have the >> official repo there instead. >> >> -- >> Christopher Redinger >> http://www.agiledisciple.com >> _______________________________________________ >> Facebooker-talk mailing list >> Facebooker-talk at rubyforge.org >> http://rubyforge.org/mailman/listinfo/facebooker-talk > > -- > Mike Mangino > http://www.elevatedrails.com > > > > -- Christopher Redinger http://www.agiledisciple.com From mmangino at elevatedrails.com Thu Jun 26 15:00:23 2008 From: mmangino at elevatedrails.com (Mike Mangino) Date: Thu, 26 Jun 2008 15:00:23 -0400 Subject: [Facebooker-talk] GitHub? In-Reply-To: <681d4e8f0806261145l3343cc99h8918641ac926ca4d@mail.gmail.com> References: <681d4e8f0806261128q3d81e956p46f6353bc6f36bdf@mail.gmail.com> <037D641E-F3F5-4DBA-9618-15E8736D8ED7@elevatedrails.com> <681d4e8f0806261145l3343cc99h8918641ac926ca4d@mail.gmail.com> Message-ID: We pulled the session key out of most of the places that don't need it already. I'm not keeping a list of items. I typically just use my own applications as the example and run things until they work :) Mike On Jun 26, 2008, at 2:45 PM, Christopher Redinger wrote: > Fantastic, thanks! > > Are you keeping a list of stuff that needs to be worked on for Rails > 2.1? Since I am using 2.1 and Facebooker in a production app now, I'd > be more than happy to contribute. > > Similar question for the changes to Facebook with regards to sessions. > For instance sessions will no longer be needed for updating profiles, > but the facebooker code uses a session to do so. Is there a plan for > rewriting that kind of thing? > > On Thu, Jun 26, 2008 at 2:36 PM, Mike Mangino > wrote: >> I guess I should announce that I added Facebooker to GitHub >> yesterday. For >> now, I think my repo there should be the official one. I'm going to >> spend a >> little time over the next couple weeks moving to make facebooker >> work with >> Rails 2.1 and via a gem plugin. >> >> Mike >> >> On Jun 26, 2008, at 2:28 PM, Christopher Redinger wrote: >> >>> Any chance of making the jump to GitHub to make contributing easier? >>> I've already got my fork over there, but it would be nicer to have >>> the >>> official repo there instead. >>> >>> -- >>> Christopher Redinger >>> http://www.agiledisciple.com >>> _______________________________________________ >>> Facebooker-talk mailing list >>> Facebooker-talk at rubyforge.org >>> http://rubyforge.org/mailman/listinfo/facebooker-talk >> >> -- >> Mike Mangino >> http://www.elevatedrails.com >> >> >> >> > > > > -- > Christopher Redinger > http://www.agiledisciple.com -- Mike Mangino http://www.elevatedrails.com From ivey at gweezlebur.com Thu Jun 26 15:32:28 2008 From: ivey at gweezlebur.com (Michael D. Ivey) Date: Thu, 26 Jun 2008 14:32:28 -0500 Subject: [Facebooker-talk] GitHub? In-Reply-To: <037D641E-F3F5-4DBA-9618-15E8736D8ED7@elevatedrails.com> References: <681d4e8f0806261128q3d81e956p46f6353bc6f36bdf@mail.gmail.com> <037D641E-F3F5-4DBA-9618-15E8736D8ED7@elevatedrails.com> Message-ID: <2EE3E2ED-5C5A-4B50-95E4-AAF86F077A08@gweezlebur.com> On Jun 26, 2008, at 1:36 PM, Mike Mangino wrote: > I guess I should announce that I added Facebooker to GitHub > yesterday. For now, I think my repo there should be the official > one. I'm going to spend a little time over the next couple weeks > moving to make facebooker work with Rails 2.1 and via a gem plugin. That's great, Mike. I hope to have time to work on merging merb_facebooker into facebooker proper. I'll fork from you soon. :) From aurelien.malisart at gmail.com Thu Jun 26 16:12:15 2008 From: aurelien.malisart at gmail.com (=?ISO-8859-1?Q?Aur=E9lien_Malisart?=) Date: Thu, 26 Jun 2008 22:12:15 +0200 Subject: [Facebooker-talk] GitHub? In-Reply-To: <2EE3E2ED-5C5A-4B50-95E4-AAF86F077A08@gweezlebur.com> References: <681d4e8f0806261128q3d81e956p46f6353bc6f36bdf@mail.gmail.com> <037D641E-F3F5-4DBA-9618-15E8736D8ED7@elevatedrails.com> <2EE3E2ED-5C5A-4B50-95E4-AAF86F077A08@gweezlebur.com> Message-ID: <83adaa130806261312m1317cc31mb8193097c9f79abf@mail.gmail.com> Great! I do not have the skills to contribute yet, but I think the switching to Git will ease the development and utilisation process! aurels -------------- next part -------------- An HTML attachment was scrubbed... URL: From jordanr at cs.washington.edu Thu Jun 26 19:14:30 2008 From: jordanr at cs.washington.edu (Richard Jordan) Date: Thu, 26 Jun 2008 16:14:30 -0700 (PDT) Subject: [Facebooker-talk] Facebooker and Rails 2.1 In-Reply-To: <7D6626A9-8569-4707-BF60-E110648AA071@scidept.com> References: <7D6626A9-8569-4707-BF60-E110648AA071@scidept.com> Message-ID: I attached a diff that fixes the unprocessed view path bug. The fix is probably not worth while in the long run because people seem to say that Rails has already changed the underlying code. But if you want use publisher and render with Rails 2.1, you'll need to insert the attached couple of lines into lib/facebooker/rails/publisher.rb. Tell me if this fixes your trouble, BJ, or anyone else. Richard On Tue, 24 Jun 2008, BJ Clark wrote: > Hello, Has anyone been working on making Facebooker play nice with Rails > 2.1? Is there a list anywhere of the current issues? > > Our only known issue is with the Publisher stuff and Templates. We get the > following error: > ActionView::TemplateFinder::InvalidViewPath (Unprocessed view path found: > "/xxxxxxx/xxxxxx/app/views/". Set your view paths with #append_view_path, > #prepend_view_path, or #view_paths=.): > > Full trace here: > http://pastie.org/216283 > > > Does anyone have a fix for this, or know where to start? > Is there any where that we could track the issues with 2.1 so we can all work > on getting Facebooker working properly? > > Thanks, > BJ Clark > Inigral > _______________________________________________ > Facebooker-talk mailing list > Facebooker-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/facebooker-talk > -------------- next part -------------- Index: lib/facebooker/rails/publisher.rb =================================================================== --- lib/facebooker/rails/publisher.rb (revision 225) +++ lib/facebooker/rails/publisher.rb (working copy) @@ -184,7 +184,7 @@ end from.set_profile_fbml(_body.profile, _body.mobile_profile, - _body.profile_action) + _body.profile_action, nil) when Ref @from.session.server_cache.set_ref_handle(_body.handle,_body.fbml) else @@ -209,7 +209,10 @@ def initialize_template_class(assigns) template_root = "#{RAILS_ROOT}/app/views/" - returning ActionView::Base.new([template_root,File.join(template_root,self.class.controller_path)], assigns, self) do |template| + controller_root = File.join(template_root,self.class.controller_path) + ActionController::Base.append_view_path(template_root) + ActionController::Base.append_view_path(controller_root) + returning ActionView::Base.new([template_root,controller_root], assigns, self) do |template| template.controller=self template.extend(self.class.master_helper_module) end @@ -289,4 +292,4 @@ end end end -end \ No newline at end of file +end From mmangino at elevatedrails.com Fri Jun 27 08:47:28 2008 From: mmangino at elevatedrails.com (Mike Mangino) Date: Fri, 27 Jun 2008 08:47:28 -0400 Subject: [Facebooker-talk] Facebooker and Rails 2.1 In-Reply-To: References: <7D6626A9-8569-4707-BF60-E110648AA071@scidept.com> Message-ID: <09E3A9FF-C84C-4FDF-83C5-51BACDABB0C4@elevatedrails.com> Thanks! I committed a small variation on this patch that maintains compatibility with Rails 2.0. Mike On Jun 26, 2008, at 7:14 PM, Richard Jordan wrote: > I attached a diff that fixes the unprocessed view path bug. The fix > is probably not worth while in the long run because people seem to > say that Rails has already changed the underlying code. But if you > want use publisher and render with Rails 2.1, you'll need to insert > the attached couple of lines into lib/facebooker/rails/publisher.rb. > > Tell me if this fixes your trouble, BJ, or anyone else. > > Richard > > On Tue, 24 Jun 2008, BJ Clark wrote: > >> Hello, Has anyone been working on making Facebooker play nice with >> Rails 2.1? Is there a list anywhere of the current issues? >> >> Our only known issue is with the Publisher stuff and Templates. We >> get the following error: >> ActionView::TemplateFinder::InvalidViewPath (Unprocessed view path >> found: "/xxxxxxx/xxxxxx/app/views/". Set your view paths with >> #append_view_path, #prepend_view_path, or #view_paths=.): >> >> Full trace here: >> http://pastie.org/216283 >> >> >> Does anyone have a fix for this, or know where to start? >> Is there any where that we could track the issues with 2.1 so we >> can all work on getting Facebooker working properly? >> >> Thanks, >> BJ Clark >> Inigral >> _______________________________________________ >> Facebooker-talk mailing list >> Facebooker-talk at rubyforge.org >> http://rubyforge.org/mailman/listinfo/facebooker-talk > < > publisher_unprocessed_view_path > .diff>_______________________________________________ > 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 Fri Jun 27 08:59:29 2008 From: mmangino at elevatedrails.com (Mike Mangino) Date: Fri, 27 Jun 2008 08:59:29 -0400 Subject: [Facebooker-talk] [PATCH] facebook_url_helper.rb v.2 In-Reply-To: References: Message-ID: > > > 3. That leaves you one last option -- edit UrlHelper itself. So, I > went back to the beginning and rewrote facebook_url_helper to > transparently change link_to, button_to, etc. That simplified the > code tremendously. I didn't even have to touch link_to directly! I > changed one darn line in button_to. Also, I had some real brilliant > breakthroughs with fbjs. Does this change the code for non canvas pages as well? I'm having a really hard time following what is going on here. Can you explain how this works? Mike > > > So, the only way facebooker can support link_to, button_to, etc. is > with the attached code. See what you think. I don't think I'd say it is the only way :) you could always do: def button_to_with_facebooker(*args) if !request_is_for_a_facebook_canvas? button_to_without_facebooker(*args) else #facebooker code here end end alias_method_chain :button_to, :facebooker That way the normal Rails path isn't impacted and you can do the bare minimum implementation that is completely custom for Facebooker. Mike > > > Richard > > On Mon, 23 Jun 2008, Mike Mangino wrote: > >> Would it be possible to make the normal version work? I hate having >> to use facebooker_button_to instead of just button_to. We did that >> with link_to_remote by just making the facebooker.js interface >> match prototype. Is that possible here too? If you can make it work >> transparently, I'll give you commit access to keep making these >> changes :) >> >> Mike > -- Mike Mangino http://www.elevatedrails.com From mmangino at elevatedrails.com Fri Jun 27 09:06:10 2008 From: mmangino at elevatedrails.com (Mike Mangino) Date: Fri, 27 Jun 2008 09:06:10 -0400 Subject: [Facebooker-talk] Facebooker and Rails 2.1 In-Reply-To: References: <7D6626A9-8569-4707-BF60-E110648AA071@scidept.com> Message-ID: <89A68A32-A40B-4B73-A539-0A2203A14DEC@elevatedrails.com> > 2. form authenticity tokens - Forms need authenticity tokens now > which I don't remember having to do before? So, facebook_form_for > seems broken. I submitted a very simple diff that adds a token in. > Didn't I commit this already? Are you still having problems with it? Mike > I've been running Rails 2.1 and just seeing what I bump into. > > Richard > -- Mike Mangino http://www.elevatedrails.com From jordanr at cs.washington.edu Fri Jun 27 11:15:08 2008 From: jordanr at cs.washington.edu (Richard Jordan) Date: Fri, 27 Jun 2008 08:15:08 -0700 (PDT) Subject: [Facebooker-talk] [PATCH] facebook_url_helper.rb v.2 In-Reply-To: References: Message-ID: > Does this change the code for non canvas pages as well? I'm having a really > hard time following what is going on here. Oh, yes, you're right my changes would would replace js with fbjs on non canvas pages as well. Yikes! > Can you explain how this works? What my code does is override methods defined in the UrlHelper -- mostly private methods. I wondered if these changes could be fragile. It seems they definately are. > I don't think I'd say it is the only way :) I was hoping you would come up with some better way. Thanks! I love learning new tricks. > you could always do: > > def button_to_with_facebooker(*args) > if !request_is_for_a_facebook_canvas? > button_to_without_facebooker(*args) > else > #facebooker code here > end > end > > alias_method_chain :button_to, :facebooker > > That way the normal Rails path isn't impacted and you can do the bare minimum > implementation that is completely custom for Facebooker. Let me see about this alias chain deal. I have been reading about it, something like a decorator pattern, right? So, we decorate button_to with my extensions if the request is inside facebook. Otherwise, we decorate button_to with nothing. We just do the old regular button_to. That's much, much better. I'll get on this change and do it first class. It's great to see material we learn in school in the real world. Richard From jordanr at cs.washington.edu Fri Jun 27 11:22:54 2008 From: jordanr at cs.washington.edu (Richard Jordan) Date: Fri, 27 Jun 2008 08:22:54 -0700 (PDT) Subject: [Facebooker-talk] Facebooker and Rails 2.1 In-Reply-To: <89A68A32-A40B-4B73-A539-0A2203A14DEC@elevatedrails.com> References: <7D6626A9-8569-4707-BF60-E110648AA071@scidept.com> <89A68A32-A40B-4B73-A539-0A2203A14DEC@elevatedrails.com> Message-ID: Yes, I still get an error on any form posts as of the current r. 225 in the rubyforge SVN trunk. Here is my simple fix. Index: lib/facebooker/rails/helpers.rb =================================================================== --- lib/facebooker/rails/helpers.rb (revision 225) +++ lib/facebooker/rails/helpers.rb (working copy) @@ -179,7 +179,10 @@ concat(tag("fb:editor",editor_options,true) , proc.binding) concat(tag(:input,{:type=>"hidden",:name=>:_method, :value=>method},false), proc.binding) unless method.blank? - fields_for( object_name,*(args << options), &proc) + if(method !='get' && protect_against_forgery?) + concat(tag(:input,{:type=>"hidden",:name=> request_forgery_protection_token.to_s, :value=>form_authenticity_token},false),proc.binding) + end + fields_for( object_name,*(args << options), &proc) concat("",proc.binding) end ================================================================== Maybe, I'm wrong somehow? Richard On Fri, 27 Jun 2008, Mike Mangino wrote: >> 2. form authenticity tokens - Forms need authenticity tokens now which I >> don't remember having to do before? So, facebook_form_for seems broken. I >> submitted a very simple diff that adds a token in. >> > > Didn't I commit this already? Are you still having problems with it? > > Mike > >> I've been running Rails 2.1 and just seeing what I bump into. >> >> Richard >> > > -- > Mike Mangino > http://www.elevatedrails.com > > > From zuk_ini at yahoo.com Fri Jun 27 21:18:06 2008 From: zuk_ini at yahoo.com (jeff barrett) Date: Fri, 27 Jun 2008 18:18:06 -0700 (PDT) Subject: [Facebooker-talk] asset_host? Message-ID: <971585.49232.qm@web32202.mail.mud.yahoo.com> Hi there, I'm wrapping my head around Facebooker to try and build some integration points between an existing ROR application and facebook. I've managed to get FB talking to my app but when I tried to access my ROR app directly I noticed that all requests for images, CSS, and JS files were being made through my callback_url. Commenting out the following line from Facebooker's init.rb made this stop, but I'm not sure what else I might be breaking with this change: ActionController::Base.asset_host = FACEBOOKER['callback_url'] if(ActionController::Base.asset_host.blank?) Any pointers? ---- We must be careful about what we pretend to be. - Kurt Vonnegut From snoodger4eva at yahoo.com Sat Jun 28 00:19:25 2008 From: snoodger4eva at yahoo.com (Jon) Date: Fri, 27 Jun 2008 21:19:25 -0700 Subject: [Facebooker-talk] How to handle facebook rails app uninstalls securely Message-ID: <3FF41FB2294046978E12EE718B33179D@epic> I just figured out how to handle facebook rails app uninstalls securely and I wanted to share how I did it in case it's useful to anyone else. I have an uninstall action in my users controller, which also means I had to setup a route like so: # facebook posts to users/uninstall, but I also want to get there via get for testing map.resources :users, :collection => {:uninstall => :any} For my particular app, I don't erase the user record when I get an uninstall ping. I get the user record and save a date in the date_uninstalled field because I figure a user might uninstall accidentally or want to reinstall later. Anyway, that's not really the point of this post - you'll do what you want on the uninstall action. My big hurdle was discovering how to check the facebook signature so I could secure the uninstall action against malicious users. So yesterday I emailed Mike Mangino and asked him: Is there a Facebooker method that can return a calculated signature that my uninstall action can use to compare with the passed signature? Or even simpler, is there maybe a method that just tells you directly whether they match? Mike emailed back saying "Session#signature_for will calculate a signature" and "Controller#verify_signature will verify one". Here's what I found after following his leads: The signature_for Facebooker method is useless for verifying a signature because it doesn't strip out the fb_sig param (note: fb_sig needs to be stripped because it's not used to make the signature - it's the value you compare your calculated signature against). Facebooker's verify_signature method is useful, but it needs a hash of params that doesn't include fb_sig (you can't just pass it params in other words). What I needed then was a method to properly prepare the params hash for the verify_signature method (by stripping fb_sig and giving me the rest). The first five lines of Facebooker's verified_facebook_params method were exactly what I need. Note: the rest of the verified_facebook_params method makes it unsuitable for getting the special hash of params that we need. It's too bad there isn't already a method in Facebooker that does just what those first five lines do and nothing else. Anyway, working with the Facebooker methods available, I created a protected method in application.rb called verify_uninstall_signature. This is what it looks like: http://pastie.org/223872 (the snippet also shows that I call the method as a before filter in the users controller -- also note the protect_from_forgery line). I hope that helps anyone else trying to figure out an efficient way to verify signatures on an uninstall request. Thanks for your help Mike! -Jon From mmangino at elevatedrails.com Sat Jun 28 17:51:18 2008 From: mmangino at elevatedrails.com (Mike Mangino) Date: Sat, 28 Jun 2008 17:51:18 -0400 Subject: [Facebooker-talk] asset_host? In-Reply-To: <971585.49232.qm@web32202.mail.mud.yahoo.com> References: <971585.49232.qm@web32202.mail.mud.yahoo.com> Message-ID: <96B5455F-1361-4445-8D36-D27860C1B287@elevatedrails.com> Is there a reason you don't want this? Otherwise, the browser will try to load your images via the Facebook canvas url, which won't work. Facebook required all assets to be served from a FQDN. Mike On Jun 27, 2008, at 9:18 PM, jeff barrett wrote: > Hi there, > > I'm wrapping my head around Facebooker to try and build some > integration points between an existing ROR application and > facebook. I've managed to get FB talking to my app but when I tried > to access my ROR app directly I noticed that all requests for > images, CSS, and JS files were being made through my callback_url. > Commenting out the following line from Facebooker's init.rb made > this stop, but I'm not sure what else I might be breaking with this > change: > > ActionController::Base.asset_host = FACEBOOKER['callback_url'] > if(ActionController::Base.asset_host.blank?) > > > Any pointers? > > ---- > We must be careful about what we pretend to be. - Kurt Vonnegut > > _______________________________________________ > Facebooker-talk mailing list > Facebooker-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/facebooker-talk -- Mike Mangino http://www.elevatedrails.com From jordanr at cs.washington.edu Sat Jun 28 21:54:21 2008 From: jordanr at cs.washington.edu (Richard Jordan) Date: Sat, 28 Jun 2008 18:54:21 -0700 (PDT) Subject: [Facebooker-talk] [PATCH] facebook_url_helper.rb v.3 In-Reply-To: References: Message-ID: Attached are a diff and a new facebook_url_helper.rb that works with both non-canvas and canvas pages using the alias_method_chaining. As requested by Charles de Buerger, I also added extra functionality to the :confirm option, so you can harness the whole power of Facebook dialogs. With :confirm => [title, prompt, styles], you can stylize a dialog's text, color, and size in full generality. It's a little bit clunky. I wanted to do :confirm => [title,prompt, {:width=>"300px",:color=>"black", ...}], but, apparently, Ruby doesn't have syntactic sugar for 2-deep hashes? You can also just pass in the regular :confirm =>"Are you sure?" like usual. See if all is ok. Richard On Fri, 27 Jun 2008, Richard Jordan wrote: >> Does this change the code for non canvas pages as well? I'm having a >> really hard time following what is going on here. > Oh, yes, you're right my changes would would replace js with fbjs on non > canvas pages as well. Yikes! > >> Can you explain how this works? > What my code does is override methods defined in the UrlHelper -- mostly > private methods. I wondered if these changes could be fragile. It seems > they definately are. > >> I don't think I'd say it is the only way :) > I was hoping you would come up with some better way. Thanks! I love > learning new tricks. > >> you could always do: >> >> def button_to_with_facebooker(*args) >> if !request_is_for_a_facebook_canvas? >> button_to_without_facebooker(*args) >> else >> #facebooker code here >> end >> end >> >> alias_method_chain :button_to, :facebooker >> >> That way the normal Rails path isn't impacted and you can do the bare >> minimum implementation that is completely custom for Facebooker. > Let me see about this alias chain deal. I have been reading about it, > something like a decorator pattern, right? So, we decorate button_to with my > extensions if the request is inside facebook. Otherwise, we decorate > button_to with nothing. We just do the old regular button_to. That's much, > much better. I'll get on this change and do it first class. It's great to > see material we learn in school in the real world. > > Richard > _______________________________________________ > Facebooker-talk mailing list > Facebooker-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/facebooker-talk > > -------------- next part -------------- # Extends the ActionView::Helpers::UrlHelper module. See it for details on # the usual url helper methods: url_for, link_to, button_to, etc. # # Mostly, the changes sanitize javascript into facebook javascript. # It sanitizes link_to solely by altering the private methods: # convert_options_to_javascript!, confirm_javascript_function, and # method_javascript_function. For button_to, it alters button_to # itself, as well as confirm_javascript_function. No other methods # need to be changed because of Facebook javascript. # # Finally, it changes current_page? not for javascript reasons, but to # adjust to the Facebook canvas root name. It strips off the canvas # root name to make current_page? return accurately within Facebook. # Because external requests come in the format # "http://test.host/controller/action" but Facebook urls come in the # format "http://apps.facebook.com/canvas_root_name/controller/action," # it has to strip off the "canvas_root_name" to adjust. A call on # current_page? for (:controller=>"x", :action=>"y") must return true # without respect to any prepended Facebook canvas root name. See # tests for more clarification. module ActionView module Helpers module UrlHelper # Alters one and only one line of the Rails button_to. See below. def button_to_with_facebooker(name, options={}, html_options = {}) if !request_is_for_a_facebook_canvas? button_to_without_facebooker(name,options,html_options) else html_options = html_options.stringify_keys convert_boolean_attributes!(html_options, %w( disabled )) method_tag = '' if (method = html_options.delete('method')) && %w{put delete}.include?(method.to_s) method_tag = tag('input', :type => 'hidden', :name => '_method', :value => method.to_s) end form_method = method.to_s == 'get' ? 'get' : 'post' request_token_tag = '' if form_method == 'post' && protect_against_forgery? request_token_tag = tag(:input, :type => "hidden", :name => request_forgery_protection_token.to_s, :value => form_authenticity_token) end if confirm = html_options.delete("confirm") # this line is the only change => html_options["onclick"] = "return #{confirm_javascript_function(confirm)}" html_options["onclick"] = "#{confirm_javascript_function(confirm, 'a.getParentNode().getParentNode().submit();')}return false;" end url = options.is_a?(String) ? options : self.url_for(options) name ||= url html_options.merge!("type" => "submit", "value" => name) "
" + method_tag + tag("input", html_options) + request_token_tag + "
" end end alias_method_chain :button_to, :facebooker # Strips off the Facebook canvas root name. def current_page_with_facebooker?(options) if !request_is_for_a_facebook_canvas? current_page_without_facebooker?(options) else # this line is the only change => url_string = CGI.escapeHTML(url_for(options)) url_string = CGI.escapeHTML(url_for(options)).gsub(/^\/#{ENV["FACEBOOKER_RELATIVE_URL_ROOT"]}(.*)/, '\1' ) request = @controller.request if url_string =~ /^\w+:\/\// url_string == "#{request.protocol}#{request.host_with_port}#{request.request_uri}" else url_string == request.request_uri end end end alias_method_chain :current_page?, :facebooker private # Redefined from controller.rb. Could be encapsilated into # some utility module to avoid repetition. def request_is_for_a_facebook_canvas? !params['fb_sig_in_canvas'].blank? end # Altered to throw an error on :popup and sanitize the javascript # for Facebook. def convert_options_to_javascript_with_facebooker!(html_options, url ='') if !request_is_for_a_facebook_canvas? convert_options_to_javascript_without_facebooker!(html_options,url) else confirm, popup = html_options.delete("confirm"), html_options.delete("popup") method, href = html_options.delete("method"), html_options['href'] html_options["onclick"] = case when popup raise ActionView::ActionViewError, "You can't use :popup" when method # or maybe (confirm and method) "#{method_javascript_function(method, url, href, confirm)}return false;" when confirm # and only confirm "#{confirm_javascript_function(confirm)}return false;" else html_options["onclick"] end end end alias_method_chain :convert_options_to_javascript!, :facebooker # Overrides a private method that link_to calls via convert_options_to_javascript! and # also, button_to calls directly. For Facebook, confirm can be an array of options to # stylize the Facebook dialog. This array goes in the format [title,prompt,style]. See # the Facebook page http://wiki.developers.facebook.com/index.php/FBJS for valid # style formats like "color: 'black', background: 'white'" or like "'color','black'". # # == Examples == # # link_to("Facebooker", "http://rubyforge.org/projects/facebooker", :confirm=>"Make Awesome Choice?") # # link_to("rFacebook", "http://rubyforge.org/projects/rfacebook", :confirm=>["Terrible!", "Are you crazy?") # # link_to("Cool page", :action=>'cool_page', :confirm=>["Please Confirm", "Are you sure?", "'width','300px'") def confirm_javascript_function_with_facebooker(confirm, fun = nil) if !request_is_for_a_facebook_canvas? confirm_javascript_function_without_facebooker(confirm) else if(confirm.is_a?(Array) and confirm.size > 3) raise ActionView::ActionViewError, "Too many options: You can only pass [title, prompt, style]" elsif(confirm.is_a?(Array) and confirm.size == 3) title,prompt,style = confirm[0],confirm[1],confirm[2] elsif(confirm.is_a?(Array) and confirm.size == 2) title,prompt,style = confirm[0],confirm[1], "'width','200px'" else title,prompt,style = 'Confirm Request', confirm, "'width','200px'" end "var dlg = new Dialog().showChoice('#{escape_javascript(title.to_s)}','#{escape_javascript(prompt.to_s)}').setStyle(#{style});"+ "var a=this;dlg.onconfirm = function() { #{fun ? fun : 'document.setLocation(a.getHref());'} };" end end alias_method_chain :confirm_javascript_function, :facebooker # Dynamically creates a form for link_to with method. Calls confirm_javascript_function if and # only if (confirm && method) for link_to def method_javascript_function_with_facebooker(method, url = '', href = nil, confirm = nil) if !request_is_for_a_facebook_canvas? method_javascript_function_without_facebooker(method,url,href) else action = (href && url.size > 0) ? "'#{url}'" : 'a.getHref()' submit_function = "var f = document.createElement('form'); f.setStyle('display','none'); " + "a.getParentNode().appendChild(f); f.setMethod('POST'); f.setAction(#{action});" unless method == :post submit_function << "var m = document.createElement('input'); m.setType('hidden'); " submit_function << "m.setName('_method'); m.setValue('#{method}'); f.appendChild(m);" end if protect_against_forgery? submit_function << "var s = document.createElement('input'); s.setType('hidden'); " submit_function << "s.setName('#{request_forgery_protection_token}'); s.setValue('#{escape_javascript form_authenticity_token}'); f.appendChild(s);" end submit_function << "f.submit();" if(confirm) confirm_javascript_function(confirm, submit_function) else "var a=this;" + submit_function end end end alias_method_chain :method_javascript_function, :facebooker end end end -------------- next part -------------- diff --git a/init.rb b/init.rb index 8ad34b8..2db13ba 100644 --- a/init.rb +++ b/init.rb @@ -19,6 +19,8 @@ require 'facebooker/rails/facebook_asset_path' require 'facebooker/rails/facebook_request_fix' require 'facebooker/rails/routing' require 'facebooker/rails/facebook_pretty_errors' rescue nil +require 'facebooker/rails/facebook_url_helper' + module ::ActionController class Base def self.inherited_with_facebooker(subclass) diff --git a/test/rails_integration_test.rb b/test/rails_integration_test.rb index 4e2babb..dcba67b 100644 --- a/test/rails_integration_test.rb +++ b/test/rails_integration_test.rb @@ -6,6 +6,7 @@ begin require 'facebooker/rails/controller' require 'facebooker/rails/helpers' require 'facebooker/rails/facebook_form_builder' + require 'facebooker/rails/facebook_url_helper' require File.dirname(__FILE__)+'/../init' require 'mocha' @@ -820,6 +821,197 @@ class RailsFacebookFormbuilderTest < Test::Unit::TestCase assert_equal "", at form_builder.multi_friend_input end end + + +class RailsUrlHelperExtensionsTest < Test::Unit::TestCase + class UrlHelperExtensionsClass + include ActionView::Helpers::UrlHelper + include ActionView::Helpers::TagHelper + def initialize(controller, canvas) + ENV['FACEBOOKER_RELATIVE_URL_ROOT'] ='facebook_app_name' + @controller = controller + @canvas = canvas + end + + def protect_against_forgery? + false + end + + def request_is_for_a_facebook_canvas? + @canvas + end + end + class UrlHelperExtensionsController < NoisyController + def index + render :nothing => true + end + def do_it + render :nothing => true + end + end + + # We need to simulate an outside request to the callback server + # where the ENV['FACEBOOK_CANVAS_PATH] == ENV['FACEBOOKER_RELATIVE_URL_ROOT'] + # is ***not*** prepended to the request uri + # ex. apps.facebook.com/facebook_app_name/controller/action (prepended) + # test.host/controller/action (***not*** prepended) + class FacebookRequest < ActionController::TestRequest + # Parse the canvas name off to simulate a real request. + def request_uri + super.gsub(/^\/#{ENV['FACEBOOKER_RELATIVE_URL_ROOT']}(.*)/, '\1' ) + end + end + + def setup + ENV['FACEBOOK_CANVAS_PATH'] ='facebook_app_name' + @controller = UrlHelperExtensionsController.new + @request = FacebookRequest.new + @response = ActionController::TestResponse.new + + @current_page = "http://test.host/rails_url_helper_extensions_test/url_helper_extensions/do_it?fb_sig_in_canvas=1" + @not_current_page = "http://some.host/control/action" + + @u = UrlHelperExtensionsClass.new(@controller, true) + @non_canvas_u = UrlHelperExtensionsClass.new(@controller, false) + @label = "Testing" + @url = "test.host" + @prompt = "Are you sure?" + @default_title = "Confirm Request" + @title = "Please Confirm" + @style = "'color: 'black', background: 'white'" + @default_style = "'width','200px'" + end + + def test_link_to + assert_equal "Testing", @u.link_to(@label, @url) + end + + def test_link_to_with_popup + assert_raises(ActionView::ActionViewError) {@u.link_to(@label, at url, :popup=>true)} + end + + def test_link_to_with_confirm + assert_dom_equal( "#{@label}", + @u.link_to(@label, @url, :confirm => @prompt) ) + end + def test_link_to_with_confirm_with_title + assert_dom_equal( "#{@label}", + @u.link_to(@label, @url, :confirm => [@title, at prompt]) ) + end + def test_link_to_with_confirm_with_title_and_style + assert_dom_equal( "#{@label}", + @u.link_to(@label, @url, :confirm => [@title, at prompt, at style]) ) + end + + def test_link_to_with_method + assert_dom_equal( "#{@label}", @u.link_to(@label, at url, :method=>:delete)) + end + + def test_link_to_with_confirm_and_method + assert_dom_equal( "#{@label}", @u.link_to(@label, at url, :confirm=>@prompt, :method=>:delete) ) + end + def test_link_to_with_confirm_and_method_for_non_canvas_page + assert_dom_equal( "#{@label}", + @non_canvas_u.link_to(@label, at url, :confirm=>@prompt, :method=>:delete) ) + end + + def test_button_to + assert_equal "
" + + "
", @u.button_to(@label, at url) + end + + def test_button_to_with_confirm + assert_equal "
" + + "
", + @u.button_to(@label, at url, :confirm=>@prompt) + end + + def test_button_to_with_confirm_for_non_canvas_page + assert_equal "
"+ + "
", + @non_canvas_u.button_to(@label, at url, :confirm=>@prompt) + end + + + def test_current_page_with_current_url_string + post :do_it, example_rails_params_including_fb + assert @u.current_page?(@current_page) + end + def test_current_page_with_non_current_url_string + post :do_it, example_rails_params_including_fb + assert !@u.current_page?(@not_current_page) + end + def test_current_page_with_current_url_hash + post :do_it, example_rails_params_including_fb + assert @u.current_page?(:action=>"do_it", :fb_sig_in_canvas=>"1") + end + def test_current_page_with_non_current_url_hash + post :do_it, example_rails_params_including_fb + assert !@u.current_page?(:action=>"not_action") + end + def test_current_page_with_current_url_hash_for_non_canvas_page + post :do_it + assert @non_canvas_u.current_page?(:action=>"do_it") + end + def test_current_page_with_non_current_url_hash_for_non_canvas_page + post :do_it + assert !@non_canvas_u.current_page?(:action=>"not_action") + end + + def test_link_to_unless_with_true + assert_equal @label, @u.link_to_unless(true, at label, at url) + end + def test_link_to_unless_with_false + assert_equal @u.link_to(@label, at url), @u.link_to_unless(false, at label, at url) + end + + def test_link_to_if_with_true + assert_equal @u.link_to(@label, at url), @u.link_to_if(true, at label, at url) + end + def test_link_to_if_with_false + assert_equal @label, @u.link_to_if(false, at label, at url) + end + + def test_link_to_unless_current_with_current + post :do_it, example_rails_params_including_fb + assert_equal @label, @u.link_to_unless_current(@label,{:action=>"do_it", :fb_sig_in_canvas=>"1"}) + end + def test_link_to_unless_current_with_not_current + post :do_it, example_rails_params_including_fb + assert_equal @u.link_to(@label,{:action=>"index",:fb_sig_in_canvas=>"1"}), + @u.link_to_unless_current(@label,{:action=>"index", :fb_sig_in_canvas=>"1"}) + end + + private + # Makes the canvas page be prepended for the current page tests + def example_rails_params_including_fb + {"fb_sig_in_canvas"=>"1"} + end +end + + + # rescue LoadError # $stderr.puts "Couldn't find action controller. That's OK. We'll skip it." end From ramkaka at gmail.com Sun Jun 29 05:09:02 2008 From: ramkaka at gmail.com (Ram Ravichandran) Date: Sun, 29 Jun 2008 05:09:02 -0400 Subject: [Facebooker-talk] gem / plugin install Message-ID: Hey, I am using Rails 2.1. I was wondering if there is a preference between using gem or script/plugin to install facebooker. Latest revision on svn (225) seems to be missing an "end" in lib/facebooker/models/user.rb (line 218). Thanks, Ram -------------- next part -------------- An HTML attachment was scrubbed... URL: From redinger at gmail.com Mon Jun 30 12:14:54 2008 From: redinger at gmail.com (Christopher Redinger) Date: Mon, 30 Jun 2008 12:14:54 -0400 Subject: [Facebooker-talk] Facebooker::Session::MissingOrInvalidParameter Message-ID: <681d4e8f0806300914r4a587115wc68d62f2edb7d0dc@mail.gmail.com> Any ideas why I'd occasionally see this error? Most of the time, the app seems to be working fine. Then we'll get some of these errors. The requests look the same to me as working requests, they include an auth_token that looks valid and have 'installed=1' in the query string. A Facebooker::Session::MissingOrInvalidParameter occurred in home#index: Invalid parameter [RAILS_ROOT]/vendor/plugins/facebooker/lib/facebooker/parser.rb:405:in `process' Here's the stack trace: ------------------------------- Environment: ------------------------------- * CONTENT_LENGTH : 3637 * CONTENT_TYPE : application/x-www-form-urlencoded * GATEWAY_INTERFACE : CGI/1.2 * HTTP_ACCEPT : */* * HTTP_ACCEPT_ENCODING: gzip * HTTP_CONNECTION : close * HTTP_CONTENT_LENGTH : 3637 * HTTP_CONTENT_TYPE : application/x-www-form-urlencoded * HTTP_COOKIE : * HTTP_HOST : www.prepchamps.com * HTTP_PRAGMA : no-cache * HTTP_USER_AGENT : Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727; FDM; .NET CLR 3.0.04506.30) * HTTP_VERSION : HTTP/1.0 * HTTP_X_FORWARDED_FOR: 69.63.176.91 * HTTP_X_REAL_IP : 69.63.176.91 * PATH_INFO : * QUERY_STRING : auth_token=2eadf6f43dfd14bbff05d445f37af7bb&installed=1 * RAW_POST_DATA : [FILTERED] * REMOTE_ADDR : 127.0.0.1 * REQUEST_METHOD : POST * REQUEST_PATH : * REQUEST_URI : /?auth_token=2eadf6f43dfd14bbff05d445f37af7bb&installed=1 * SCRIPT_NAME : / * SERVER_NAME : www.prepchamps.com * SERVER_PORT : 80 * SERVER_PROTOCOL : HTTP/1.1 * SERVER_SOFTWARE : Mongrel 1.1.5 ------------------------------- Backtrace: ------------------------------- [RAILS_ROOT]/vendor/plugins/facebooker/lib/facebooker/parser.rb:405:in `process' [RAILS_ROOT]/vendor/plugins/facebooker/lib/facebooker/parser.rb:15:in `parse' [RAILS_ROOT]/vendor/plugins/facebooker/lib/facebooker/service.rb:14:in `post' [RAILS_ROOT]/vendor/plugins/facebooker/lib/facebooker/session.rb:411:in `post' [RAILS_ROOT]/vendor/plugins/facebooker/lib/facebooker/session.rb:150:in `secure!' [RAILS_ROOT]/vendor/plugins/facebooker/lib/facebooker/rails/controller.rb:45:in `secure_with_token!' [RAILS_ROOT]/vendor/plugins/facebooker/lib/facebooker/rails/controller.rb:23:in `set_facebook_session' [RAILS_ROOT]/vendor/plugins/facebooker/lib/facebooker/rails/controller.rb:167:in `ensure_authenticated_to_facebook' [RAILS_ROOT]/vendor/plugins/facebooker/lib/facebooker/rails/controller.rb:172:in `ensure_application_is_installed_by_facebook_user' [RAILS_ROOT]/vendor/rails/activesupport/lib/active_support/callbacks.rb:173:in `send' [RAILS_ROOT]/vendor/rails/activesupport/lib/active_support/callbacks.rb:173:in `evaluate_method' [RAILS_ROOT]/vendor/rails/activesupport/lib/active_support/callbacks.rb:161:in `call' [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/filters.rb:430:in `call' [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/filters.rb:592:in `run_before_filters' [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/filters.rb:578:in `call_filters' [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/filters.rb:573:in `perform_action_without_benchmark' [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue' /usr/lib64/ruby/1.8/benchmark.rb:293:in `measure' [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue' [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/rescue.rb:201:in `perform_action_without_caching' [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/caching/sql_cache.rb:13:in `perform_action' [RAILS_ROOT]/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:33:in `cache' [RAILS_ROOT]/vendor/rails/activerecord/lib/active_record/query_cache.rb:8:in `cache' [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/caching/sql_cache.rb:12:in `perform_action' [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/base.rb:529:in `send' [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/base.rb:529:in `process_without_filters' [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/filters.rb:569:in `process_without_session_management_support' [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/session_management.rb:130:in `sass_old_process' [RAILS_ROOT]/vendor/gems/haml-2.1.0/lib/sass/plugin/rails.rb:19:in `process' [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/base.rb:389:in `process' [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:149:in `handle_request' [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:107:in `dispatch' [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:104:in `synchronize' [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:104:in `dispatch' [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:120:in `dispatch_cgi' [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:35:in `dispatch' /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/rails.rb:76:in `process' /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/rails.rb:74:in `synchronize' /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/rails.rb:74:in `process' /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:159:in `process_client' /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in `each' /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in `process_client' /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run' /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `initialize' /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `new' /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run' /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `initialize' /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `new' /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `run' /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:282:in `run' /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:281:in `each' /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:281:in `run' /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:128:in `run' /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/command.rb:212:in `run' /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:281 /usr/bin/mongrel_rails:19:in `load' /usr/bin/mongrel_rails:19 -- Christopher Redinger http://www.agiledisciple.com From zuk_ini at yahoo.com Mon Jun 30 12:21:09 2008 From: zuk_ini at yahoo.com (jeff barrett) Date: Mon, 30 Jun 2008 09:21:09 -0700 (PDT) Subject: [Facebooker-talk] asset_host? Message-ID: <241968.6310.qm@web32202.mail.mud.yahoo.com> Hi Mike, Sorry I didn't make this more clear. Requesting assets from the callback_url makes sense to me when RoR is processing a request from FB. But when I access my app directly, say from http://localhost:3000, all of the assets are retrieved from the callback_url instead of http://localhost:3000. What I had assumed would happen is that for a FB request the callback_url would be used, and for a "regular" request the typical rails behavior would occur. Am I thinking about this correctly? Thanks. ---- We must be careful about what we pretend to be. - Kurt Vonnegut ----- Original Message ---- From: Mike Mangino To: jeff barrett Cc: facebooker-talk at rubyforge.org Sent: Saturday, June 28, 2008 2:51:18 PM Subject: Re: [Facebooker-talk] asset_host? Is there a reason you don't want this? Otherwise, the browser will try to load your images via the Facebook canvas url, which won't work. Facebook required all assets to be served from a FQDN. Mike On Jun 27, 2008, at 9:18 PM, jeff barrett wrote: > Hi there, > > I'm wrapping my head around Facebooker to try and build some > integration points between an existing ROR application and > facebook. I've managed to get FB talking to my app but when I tried > to access my ROR app directly I noticed that all requests for > images, CSS, and JS files were being made through my callback_url. > Commenting out the following line from Facebooker's init.rb made > this stop, but I'm not sure what else I might be breaking with this > change: > > ActionController::Base.asset_host = FACEBOOKER['callback_url'] > if(ActionController::Base.asset_host.blank?) > > > Any pointers? > > ---- > We must be careful about what we pretend to be. - Kurt Vonnegut > > _______________________________________________ > 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 Mon Jun 30 12:51:56 2008 From: mmangino at elevatedrails.com (Mike Mangino) Date: Mon, 30 Jun 2008 12:51:56 -0400 Subject: [Facebooker-talk] asset_host? In-Reply-To: <241968.6310.qm@web32202.mail.mud.yahoo.com> References: <241968.6310.qm@web32202.mail.mud.yahoo.com> Message-ID: I think your assumption makes sense, but that isn't how Facebooker works. We might be able to make it work that way, but I don't really see any benefit from it. Is there a reason that you need this behavior? Mike On Jun 30, 2008, at 12:21 PM, jeff barrett wrote: > Hi Mike, > > Sorry I didn't make this more clear. Requesting assets from the > callback_url makes sense to me when RoR is processing a request from > FB. But when I access my app directly, say from http://localhost: > 3000, all of the assets are retrieved from the callback_url instead > of http://localhost:3000. What I had assumed would happen is that > for a FB request the callback_url would be used, and for a "regular" > request the typical rails behavior would occur. Am I thinking about > this correctly? > > Thanks. > > ---- > We must be careful about what we pretend to be. - Kurt Vonnegut > > > ----- Original Message ---- > From: Mike Mangino > To: jeff barrett > Cc: facebooker-talk at rubyforge.org > Sent: Saturday, June 28, 2008 2:51:18 PM > Subject: Re: [Facebooker-talk] asset_host? > > Is there a reason you don't want this? Otherwise, the browser will try > to load your images via the Facebook canvas url, which won't work. > Facebook required all assets to be served from a FQDN. > > Mike > > On Jun 27, 2008, at 9:18 PM, jeff barrett wrote: > >> Hi there, >> >> I'm wrapping my head around Facebooker to try and build some >> integration points between an existing ROR application and >> facebook. I've managed to get FB talking to my app but when I tried >> to access my ROR app directly I noticed that all requests for >> images, CSS, and JS files were being made through my callback_url. >> Commenting out the following line from Facebooker's init.rb made >> this stop, but I'm not sure what else I might be breaking with this >> change: >> >> ActionController::Base.asset_host = FACEBOOKER['callback_url'] >> if(ActionController::Base.asset_host.blank?) >> >> >> Any pointers? >> >> ---- >> We must be careful about what we pretend to be. - Kurt Vonnegut >> >> _______________________________________________ >> 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 zuk_ini at yahoo.com Mon Jun 30 15:09:58 2008 From: zuk_ini at yahoo.com (jeff barrett) Date: Mon, 30 Jun 2008 12:09:58 -0700 (PDT) Subject: [Facebooker-talk] asset_host? Message-ID: <150588.52529.qm@web32203.mail.mud.yahoo.com> Maybe I'm missing something... I think I can probably work around this behavior, but maybe I'm not understanding the goal of Facebooker. Is Facebooker built with the assumption that the only requests hitting the RoR app are FB requests. Or to put it another way, if my app serves content to non-FB and FB requests, don't I want the non-FB requests to be handled exactly like the were before installing the Facebooker plugin? ---- We must be careful about what we pretend to be. - Kurt Vonnegut ----- Original Message ---- From: Mike Mangino To: jeff barrett Cc: facebooker-talk at rubyforge.org Sent: Monday, June 30, 2008 9:51:56 AM Subject: Re: [Facebooker-talk] asset_host? I think your assumption makes sense, but that isn't how Facebooker works. We might be able to make it work that way, but I don't really see any benefit from it. Is there a reason that you need this behavior? Mike On Jun 30, 2008, at 12:21 PM, jeff barrett wrote: > Hi Mike, > > Sorry I didn't make this more clear. Requesting assets from the > callback_url makes sense to me when RoR is processing a request from > FB. But when I access my app directly, say from http://localhost: > 3000, all of the assets are retrieved from the callback_url instead > of http://localhost:3000. What I had assumed would happen is that > for a FB request the callback_url would be used, and for a "regular" > request the typical rails behavior would occur. Am I thinking about > this correctly? > > Thanks. > > ---- > We must be careful about what we pretend to be. - Kurt Vonnegut > > > ----- Original Message ---- > From: Mike Mangino > To: jeff barrett > Cc: facebooker-talk at rubyforge.org > Sent: Saturday, June 28, 2008 2:51:18 PM > Subject: Re: [Facebooker-talk] asset_host? > > Is there a reason you don't want this? Otherwise, the browser will try > to load your images via the Facebook canvas url, which won't work. > Facebook required all assets to be served from a FQDN. > > Mike > > On Jun 27, 2008, at 9:18 PM, jeff barrett wrote: > >> Hi there, >> >> I'm wrapping my head around Facebooker to try and build some >> integration points between an existing ROR application and >> facebook. I've managed to get FB talking to my app but when I tried >> to access my ROR app directly I noticed that all requests for >> images, CSS, and JS files were being made through my callback_url. >> Commenting out the following line from Facebooker's init.rb made >> this stop, but I'm not sure what else I might be breaking with this >> change: >> >> ActionController::Base.asset_host = FACEBOOKER['callback_url'] >> if(ActionController::Base.asset_host.blank?) >> >> >> Any pointers? >> >> ---- >> We must be careful about what we pretend to be. - Kurt Vonnegut >> >> _______________________________________________ >> 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 mniessner at elevatedrails.com Mon Jun 30 15:21:05 2008 From: mniessner at elevatedrails.com (Michael Niessner) Date: Mon, 30 Jun 2008 14:21:05 -0500 Subject: [Facebooker-talk] Facebooker::Session::MissingOrInvalidParameter In-Reply-To: <681d4e8f0806300914r4a587115wc68d62f2edb7d0dc@mail.gmail.com> References: <681d4e8f0806300914r4a587115wc68d62f2edb7d0dc@mail.gmail.com> Message-ID: Is this that problem where the user refreshes the page that has the auth_token in the url? I thought that was fixed at some point. Michael On Jun 30, 2008, at 11:14 AM, Christopher Redinger wrote: > Any ideas why I'd occasionally see this error? Most of the time, the > app seems to be working fine. Then we'll get some of these errors. The > requests look the same to me as working requests, they include an > auth_token that looks valid and have 'installed=1' in the query > string. > > A Facebooker::Session::MissingOrInvalidParameter occurred in > home#index: > > Invalid parameter > [RAILS_ROOT]/vendor/plugins/facebooker/lib/facebooker/parser.rb:405:in > `process' > > > Here's the stack trace: > > ------------------------------- > Environment: > ------------------------------- > > * CONTENT_LENGTH : 3637 > * CONTENT_TYPE : application/x-www-form-urlencoded > * GATEWAY_INTERFACE : CGI/1.2 > * HTTP_ACCEPT : */* > * HTTP_ACCEPT_ENCODING: gzip > * HTTP_CONNECTION : close > * HTTP_CONTENT_LENGTH : 3637 > * HTTP_CONTENT_TYPE : application/x-www-form-urlencoded > * HTTP_COOKIE : > * HTTP_HOST : www.prepchamps.com > * HTTP_PRAGMA : no-cache > * HTTP_USER_AGENT : Mozilla/4.0 (compatible; MSIE 6.0; Windows NT > 5.1; SV1; .NET CLR 2.0.50727; FDM; .NET CLR 3.0.04506.30) > * HTTP_VERSION : HTTP/1.0 > * HTTP_X_FORWARDED_FOR: 69.63.176.91 > * HTTP_X_REAL_IP : 69.63.176.91 > * PATH_INFO : > * QUERY_STRING : > auth_token=2eadf6f43dfd14bbff05d445f37af7bb&installed=1 > * RAW_POST_DATA : [FILTERED] > * REMOTE_ADDR : 127.0.0.1 > * REQUEST_METHOD : POST > * REQUEST_PATH : > * REQUEST_URI : > /?auth_token=2eadf6f43dfd14bbff05d445f37af7bb&installed=1 > * SCRIPT_NAME : / > * SERVER_NAME : www.prepchamps.com > * SERVER_PORT : 80 > * SERVER_PROTOCOL : HTTP/1.1 > * SERVER_SOFTWARE : Mongrel 1.1.5 > > ------------------------------- > Backtrace: > ------------------------------- > > [RAILS_ROOT]/vendor/plugins/facebooker/lib/facebooker/parser.rb:405:in > `process' > [RAILS_ROOT]/vendor/plugins/facebooker/lib/facebooker/parser.rb: > 15:in `parse' > [RAILS_ROOT]/vendor/plugins/facebooker/lib/facebooker/service.rb: > 14:in `post' > [RAILS_ROOT]/vendor/plugins/facebooker/lib/facebooker/session.rb: > 411:in `post' > [RAILS_ROOT]/vendor/plugins/facebooker/lib/facebooker/session.rb: > 150:in > `secure!' > [RAILS_ROOT]/vendor/plugins/facebooker/lib/facebooker/rails/ > controller.rb:45:in > `secure_with_token!' > [RAILS_ROOT]/vendor/plugins/facebooker/lib/facebooker/rails/ > controller.rb:23:in > `set_facebook_session' > [RAILS_ROOT]/vendor/plugins/facebooker/lib/facebooker/rails/ > controller.rb:167:in > `ensure_authenticated_to_facebook' > [RAILS_ROOT]/vendor/plugins/facebooker/lib/facebooker/rails/ > controller.rb:172:in > `ensure_application_is_installed_by_facebook_user' > [RAILS_ROOT]/vendor/rails/activesupport/lib/active_support/ > callbacks.rb:173:in > `send' > [RAILS_ROOT]/vendor/rails/activesupport/lib/active_support/ > callbacks.rb:173:in > `evaluate_method' > [RAILS_ROOT]/vendor/rails/activesupport/lib/active_support/ > callbacks.rb:161:in > `call' > [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/ > filters.rb:430:in > `call' > [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/ > filters.rb:592:in > `run_before_filters' > [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/ > filters.rb:578:in > `call_filters' > [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/ > filters.rb:573:in > `perform_action_without_benchmark' > [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/ > benchmarking.rb:68:in > `perform_action_without_rescue' > /usr/lib64/ruby/1.8/benchmark.rb:293:in `measure' > [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/ > benchmarking.rb:68:in > `perform_action_without_rescue' > [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/rescue.rb: > 201:in > `perform_action_without_caching' > [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/caching/ > sql_cache.rb:13:in > `perform_action' > [RAILS_ROOT]/vendor/rails/activerecord/lib/active_record/ > connection_adapters/abstract/query_cache.rb:33:in > `cache' > [RAILS_ROOT]/vendor/rails/activerecord/lib/active_record/ > query_cache.rb:8:in > `cache' > [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/caching/ > sql_cache.rb:12:in > `perform_action' > [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/base.rb: > 529:in > `send' > [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/base.rb: > 529:in > `process_without_filters' > [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/ > filters.rb:569:in > `process_without_session_management_support' > [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/ > session_management.rb:130:in > `sass_old_process' > [RAILS_ROOT]/vendor/gems/haml-2.1.0/lib/sass/plugin/rails.rb:19:in > `process' > [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/base.rb: > 389:in > `process' > [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/ > dispatcher.rb:149:in > `handle_request' > [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/ > dispatcher.rb:107:in > `dispatch' > [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/ > dispatcher.rb:104:in > `synchronize' > [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/ > dispatcher.rb:104:in > `dispatch' > [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/ > dispatcher.rb:120:in > `dispatch_cgi' > [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/ > dispatcher.rb:35:in > `dispatch' > /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/rails.rb:76:in > `process' > /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/rails.rb:74:in > `synchronize' > /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/rails.rb:74:in > `process' > /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:159:in > `process_client' > /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in > `each' > /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in > `process_client' > /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in > `run' > /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in > `initialize' > /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in > `new' > /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in > `run' > /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in > `initialize' > /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in > `new' > /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in > `run' > /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/ > configurator.rb:282:in > `run' > /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/ > configurator.rb:281:in > `each' > /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/ > configurator.rb:281:in > `run' > /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:128:in > `run' > /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/command.rb: > 212:in `run' > /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:281 > /usr/bin/mongrel_rails:19:in `load' > /usr/bin/mongrel_rails:19 > -- > Christopher Redinger > http://www.agiledisciple.com > _______________________________________________ > Facebooker-talk mailing list > Facebooker-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/facebooker-talk From redinger at gmail.com Mon Jun 30 15:27:39 2008 From: redinger at gmail.com (Christopher Redinger) Date: Mon, 30 Jun 2008 15:27:39 -0400 Subject: [Facebooker-talk] Facebooker::Session::MissingOrInvalidParameter In-Reply-To: References: <681d4e8f0806300914r4a587115wc68d62f2edb7d0dc@mail.gmail.com> Message-ID: <681d4e8f0806301227l3cac3da0l99df024ab05323b4@mail.gmail.com> I just gave this a try, and that doesn't seem to be the problem. I was pointed to the possibility of a performance problem - my app not responding in time. So, I am investigating that right now. On Mon, Jun 30, 2008 at 3:21 PM, Michael Niessner wrote: > Is this that problem where the user refreshes the page that has the > auth_token in the url? I thought that was fixed at some point. > > Michael > > > On Jun 30, 2008, at 11:14 AM, Christopher Redinger wrote: > >> Any ideas why I'd occasionally see this error? Most of the time, the >> app seems to be working fine. Then we'll get some of these errors. The >> requests look the same to me as working requests, they include an >> auth_token that looks valid and have 'installed=1' in the query >> string. >> >> A Facebooker::Session::MissingOrInvalidParameter occurred in home#index: >> >> Invalid parameter >> [RAILS_ROOT]/vendor/plugins/facebooker/lib/facebooker/parser.rb:405:in >> `process' >> >> >> Here's the stack trace: >> >> ------------------------------- >> Environment: >> ------------------------------- >> >> * CONTENT_LENGTH : 3637 >> * CONTENT_TYPE : application/x-www-form-urlencoded >> * GATEWAY_INTERFACE : CGI/1.2 >> * HTTP_ACCEPT : */* >> * HTTP_ACCEPT_ENCODING: gzip >> * HTTP_CONNECTION : close >> * HTTP_CONTENT_LENGTH : 3637 >> * HTTP_CONTENT_TYPE : application/x-www-form-urlencoded >> * HTTP_COOKIE : >> * HTTP_HOST : www.prepchamps.com >> * HTTP_PRAGMA : no-cache >> * HTTP_USER_AGENT : Mozilla/4.0 (compatible; MSIE 6.0; Windows NT >> 5.1; SV1; .NET CLR 2.0.50727; FDM; .NET CLR 3.0.04506.30) >> * HTTP_VERSION : HTTP/1.0 >> * HTTP_X_FORWARDED_FOR: 69.63.176.91 >> * HTTP_X_REAL_IP : 69.63.176.91 >> * PATH_INFO : >> * QUERY_STRING : >> auth_token=2eadf6f43dfd14bbff05d445f37af7bb&installed=1 >> * RAW_POST_DATA : [FILTERED] >> * REMOTE_ADDR : 127.0.0.1 >> * REQUEST_METHOD : POST >> * REQUEST_PATH : >> * REQUEST_URI : >> /?auth_token=2eadf6f43dfd14bbff05d445f37af7bb&installed=1 >> * SCRIPT_NAME : / >> * SERVER_NAME : www.prepchamps.com >> * SERVER_PORT : 80 >> * SERVER_PROTOCOL : HTTP/1.1 >> * SERVER_SOFTWARE : Mongrel 1.1.5 >> >> ------------------------------- >> Backtrace: >> ------------------------------- >> >> [RAILS_ROOT]/vendor/plugins/facebooker/lib/facebooker/parser.rb:405:in >> `process' >> [RAILS_ROOT]/vendor/plugins/facebooker/lib/facebooker/parser.rb:15:in >> `parse' >> [RAILS_ROOT]/vendor/plugins/facebooker/lib/facebooker/service.rb:14:in >> `post' >> [RAILS_ROOT]/vendor/plugins/facebooker/lib/facebooker/session.rb:411:in >> `post' >> [RAILS_ROOT]/vendor/plugins/facebooker/lib/facebooker/session.rb:150:in >> `secure!' >> >> [RAILS_ROOT]/vendor/plugins/facebooker/lib/facebooker/rails/controller.rb:45:in >> `secure_with_token!' >> >> [RAILS_ROOT]/vendor/plugins/facebooker/lib/facebooker/rails/controller.rb:23:in >> `set_facebook_session' >> >> [RAILS_ROOT]/vendor/plugins/facebooker/lib/facebooker/rails/controller.rb:167:in >> `ensure_authenticated_to_facebook' >> >> [RAILS_ROOT]/vendor/plugins/facebooker/lib/facebooker/rails/controller.rb:172:in >> `ensure_application_is_installed_by_facebook_user' >> >> [RAILS_ROOT]/vendor/rails/activesupport/lib/active_support/callbacks.rb:173:in >> `send' >> >> [RAILS_ROOT]/vendor/rails/activesupport/lib/active_support/callbacks.rb:173:in >> `evaluate_method' >> >> [RAILS_ROOT]/vendor/rails/activesupport/lib/active_support/callbacks.rb:161:in >> `call' >> >> [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/filters.rb:430:in >> `call' >> >> [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/filters.rb:592:in >> `run_before_filters' >> >> [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/filters.rb:578:in >> `call_filters' >> >> [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/filters.rb:573:in >> `perform_action_without_benchmark' >> >> [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in >> `perform_action_without_rescue' >> /usr/lib64/ruby/1.8/benchmark.rb:293:in `measure' >> >> [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in >> `perform_action_without_rescue' >> >> [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/rescue.rb:201:in >> `perform_action_without_caching' >> >> [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/caching/sql_cache.rb:13:in >> `perform_action' >> >> [RAILS_ROOT]/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:33:in >> `cache' >> >> [RAILS_ROOT]/vendor/rails/activerecord/lib/active_record/query_cache.rb:8:in >> `cache' >> >> [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/caching/sql_cache.rb:12:in >> `perform_action' >> [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/base.rb:529:in >> `send' >> [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/base.rb:529:in >> `process_without_filters' >> >> [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/filters.rb:569:in >> `process_without_session_management_support' >> >> [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/session_management.rb:130:in >> `sass_old_process' >> [RAILS_ROOT]/vendor/gems/haml-2.1.0/lib/sass/plugin/rails.rb:19:in >> `process' >> [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/base.rb:389:in >> `process' >> >> [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:149:in >> `handle_request' >> >> [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:107:in >> `dispatch' >> >> [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:104:in >> `synchronize' >> >> [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:104:in >> `dispatch' >> >> [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:120:in >> `dispatch_cgi' >> >> [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:35:in >> `dispatch' >> /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/rails.rb:76:in >> `process' >> /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/rails.rb:74:in >> `synchronize' >> /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/rails.rb:74:in >> `process' >> /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:159:in >> `process_client' >> /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in `each' >> /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in >> `process_client' >> /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run' >> /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in >> `initialize' >> /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `new' >> /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run' >> /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in >> `initialize' >> /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `new' >> /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `run' >> >> /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:282:in >> `run' >> >> /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:281:in >> `each' >> >> /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:281:in >> `run' >> /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:128:in `run' >> /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/command.rb:212:in >> `run' >> /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:281 >> /usr/bin/mongrel_rails:19:in `load' >> /usr/bin/mongrel_rails:19 >> -- >> Christopher Redinger >> http://www.agiledisciple.com >> _______________________________________________ >> Facebooker-talk mailing list >> Facebooker-talk at rubyforge.org >> http://rubyforge.org/mailman/listinfo/facebooker-talk > > -- Christopher Redinger http://www.agiledisciple.com From digidigo at gmail.com Mon Jun 30 15:31:03 2008 From: digidigo at gmail.com (David Clements) Date: Mon, 30 Jun 2008 13:31:03 -0600 Subject: [Facebooker-talk] asset_host? In-Reply-To: <150588.52529.qm@web32203.mail.mud.yahoo.com> References: <150588.52529.qm@web32203.mail.mud.yahoo.com> Message-ID: Hey Jeff, I am running a couple for Rails apps this way, web based and facebook based. The only difference in the requests is the use of an asset host. The only drawback to this that I have found is that in development mode the request for assets go through my SSH tunnel that I have setup , which can slow things up a bit. What are you running into that you need to workaround this behavior? Dave On Mon, Jun 30, 2008 at 1:09 PM, jeff barrett wrote: > Maybe I'm missing something... I think I can probably work around this > behavior, but maybe I'm not understanding the goal of Facebooker. Is > Facebooker built with the assumption that the only requests hitting the RoR > app are FB requests. Or to put it another way, if my app serves content to > non-FB and FB requests, don't I want the non-FB requests to be handled > exactly like the were before installing the Facebooker plugin? > > ---- > We must be careful about what we pretend to be. - Kurt Vonnegut > > > ----- Original Message ---- > From: Mike Mangino > To: jeff barrett > Cc: facebooker-talk at rubyforge.org > Sent: Monday, June 30, 2008 9:51:56 AM > Subject: Re: [Facebooker-talk] asset_host? > > I think your assumption makes sense, but that isn't how Facebooker > works. We might be able to make it work that way, but I don't really > see any benefit from it. Is there a reason that you need this behavior? > > Mike > > On Jun 30, 2008, at 12:21 PM, jeff barrett wrote: > > > Hi Mike, > > > > Sorry I didn't make this more clear. Requesting assets from the > > callback_url makes sense to me when RoR is processing a request from > > FB. But when I access my app directly, say from http://localhost: > > 3000, all of the assets are retrieved from the callback_url instead > > of http://localhost:3000. What I had assumed would happen is that > > for a FB request the callback_url would be used, and for a "regular" > > request the typical rails behavior would occur. Am I thinking about > > this correctly? > > > > Thanks. > > > > ---- > > We must be careful about what we pretend to be. - Kurt Vonnegut > > > > > > ----- Original Message ---- > > From: Mike Mangino > > To: jeff barrett > > Cc: facebooker-talk at rubyforge.org > > Sent: Saturday, June 28, 2008 2:51:18 PM > > Subject: Re: [Facebooker-talk] asset_host? > > > > Is there a reason you don't want this? Otherwise, the browser will try > > to load your images via the Facebook canvas url, which won't work. > > Facebook required all assets to be served from a FQDN. > > > > Mike > > > > On Jun 27, 2008, at 9:18 PM, jeff barrett wrote: > > > >> Hi there, > >> > >> I'm wrapping my head around Facebooker to try and build some > >> integration points between an existing ROR application and > >> facebook. I've managed to get FB talking to my app but when I tried > >> to access my ROR app directly I noticed that all requests for > >> images, CSS, and JS files were being made through my callback_url. > >> Commenting out the following line from Facebooker's init.rb made > >> this stop, but I'm not sure what else I might be breaking with this > >> change: > >> > >> ActionController::Base.asset_host = FACEBOOKER['callback_url'] > >> if(ActionController::Base.asset_host.blank?) > >> > >> > >> Any pointers? > >> > >> ---- > >> We must be careful about what we pretend to be. - Kurt Vonnegut > >> > >> _______________________________________________ > >> 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 > _______________________________________________ > Facebooker-talk mailing list > Facebooker-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/facebooker-talk > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jordanr at cs.washington.edu Mon Jun 30 20:56:46 2008 From: jordanr at cs.washington.edu (Richard Jordan) Date: Mon, 30 Jun 2008 17:56:46 -0700 (PDT) Subject: [Facebooker-talk] gem / plugin install In-Reply-To: References: Message-ID: Check out the Facebooker from gitHub by doing, git clone git://github.com/mmangino/facebooker.git It's now the official one, right? I don't know about preferences. Richard On Sun, 29 Jun 2008, Ram Ravichandran wrote: > Hey, > > I am using Rails 2.1. I was wondering if there is a preference between using > gem or script/plugin to install facebooker. Latest revision on svn (225) > seems to be missing an "end" in lib/facebooker/models/user.rb (line 218). > > Thanks, > Ram >