SlideShare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our User Agreement and Privacy Policy.
SlideShare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our Privacy Policy and User Agreement for details.
Successfully reported this slideshow.
Activate your 14 day free trial to unlock unlimited reading.
1.
Rails vs. Facebooker
Facebook-Apps mit Facebooker
Jan Krutisch <jan.krutisch@mindmatters.de>
10. Juni 2009
Rails Usergroup Hamburg
Donnerstag, 11. Juni 2009
49.
• Sehr coole API-Umsetzung
• before_filter f. Auth etc.
• Fast alle APIs abgedeckt
• Publisher (wie Mailer) f. Notifications,
Profile, Profile-Publisher
• FBML-Helper
Donnerstag, 11. Juni 2009
60.
ApplicatioController
Donnerstag, 11. Juni 2009
61.
# Filters added to this controller apply to all controllers in the application.
# Likewise, all the methods added will be available for all controllers.
class ApplicationController < ActionController::Base
include ExceptionNotifiable
helper :all # include all helpers, all the time
protect_from_forgery # See ActionController::RequestForgeryProtection for d...
helper_attr :current_user
attr_accessor :current_user
ensure_authenticated_to_facebook
before_filter :create_facebook_session, :set_current_user
# Scrub sensitive parameters from your log
# filter_parameter_logging :password
def set_current_user
self.current_user = User.for(facebook_session.user.to_i, facebook_session)
end
end
Donnerstag, 11. Juni 2009
70.
class ProfilePublisherController < ApplicationController
skip_before_filter :ensure_authenticated_to_facebook
def index
if current_user.nil? and facebook_params[:user]
self.current_user = User.for(facebook_params[:user])
end
if wants_interface?
@images = DailyImage.latest.all(:limit => 10)
render_publisher_interface(render_to_string(:partial=>quot;formquot;, :assigns =>
{:images => @images}))
else
@image = DailyImage.find(params[:app_params][:id])
render_publisher_response(GalleryPublisher.create_image_feed(current_user,
@image))
end
end
end
Donnerstag, 11. Juni 2009