Created
March 9, 2013 07:56
-
-
Save jclosure/5123387 to your computer and use it in GitHub Desktop.
Everything is a method in ruby, including if and else. Set from YAML
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#USE IF/ELSE TO SET @config | |
@config ||= if ENV['fb_client_id'] && ENV['fb_client_secret'] && ENV['fb_scope'] && ENV['fb_canvas_url'] | |
{ | |
:client_id => ENV['fb_client_id'], | |
:client_secret => ENV['fb_client_secret'], | |
:scope => ENV['fb_scope'], | |
:canvas_url => ENV['fb_canvas_url'] | |
} | |
else | |
YAML.load_file("#{Rails.root}/config/facebook.yml")[Rails.env].symbolize_keys | |
end | |
#THE YAML LOOKS LIKE THIS | |
development: &defaults | |
client_id: 610477565632318 | |
client_secret: 1b6329dd8984966b75a84c54d76e542c | |
scope: user_about_me,friends_about_me,user_activities,friends_activities,user_birthday,friends_birthday,user_checkins,friends_checkins,user_education_history,friends_education_history,user_events,friends_events,user_groups,friends_groups,user_hometown,friends_hometown,user_interests,friends_interests,user_likes,friends_likes,user_location,friends_location,user_notes,friends_notes,user_online_presence,friends_online_presence,user_photo_video_tags,friends_photo_video_tags,user_photos,friends_photos,user_questions,friends_questions,user_relationships,friends_relationships,user_relationship_details,friends_relationship_details,user_religion_politics,friends_religion_politics,user_status,friends_status,user_videos,friends_videos,user_website,friends_website,user_work_history,friends_work_history,email,read_friendlists,read_insights,read_mailbox,read_requests,read_stream,xmpp_login,ads_management,create_event,manage_friendlists,manage_notifications,offline_access,publish_checkins,publish_stream,rsvp_event,publish_actions,manage_pages,user_subscriptions #,friend_subscriptions | |
canvas_url: http://apps.facebook.com/fbgraph | |
test: | |
<<: *defaults | |
production: | |
<<: *defaults |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment