Question

General problem. Working on a ROR app hosted on Heroku. However I am getting the error in local environment. For Articles I wish users to be able to "recommend" the article via Facebook and display number of "recommends" the Article has recieved.
I have a ROR application on Heroku and have set up a Facebook app with minimum info. Where/how do I add in the Facebook info he ROR application.

I have tried a number of different things including (1) adding some info to config/environment/development e.g.

# Facebook stuff 
config.fb_app_id = 257669251071656
config.fb_app_secret = 7b53604575d5dc0259466cfd41808c93

which gives error

/Users/davidlee/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.4/lib/active_support/dependencies.rb:229:in `require': /Volumes/F Drive/drill_investor/config/environments/development.rb:49: syntax error, unexpected tIDENTIFIER, expecting keyword_end (SyntaxError)

Should I be adding a config/initializers/facebook.rb file and/or changes in config/environments/development…production. If so what goes into the onfig/initializers/facebook.rb file ?

At the moment I have some stuff set up for devise and paperclip in these directories - however this was all copied and haven't figured out how it actually works.

any help appreciated Pierre

The new whole config/application.rb file, with comments removed, is below

require File.expand_path('../boot', __FILE__)

require 'rails/all'

Bundler.require(:default, Rails.env)

module  DrillInvestor
  class Application < Rails::Application

  # pmlc 
  ActsAsTaggableOn.force_lowercase = true
  ActsAsTaggableOn.remove_unused_tags = true
  config.fb_app_id = ENV["FACEBOOK_APP"]
  config.fb_app_secret = ENV["FACEBOOK_SECRET"]
  # pmlc

  end
end
Was it helpful?

Solution

The environment files of Rails are meant to give you a place to specific environment-specific settings -- such as different asset paths, Gem settings, etc to use


Error

Your error basically says your development.rbfile is not formatted correctly (you should post the whole file). You'll need to be able to set it out correctly - I'd even recommend putting the details into application.rb:

#config/application.rb
config.fb_app_id = ENV["FACEBOOK_APP"]
config.fb_app_secret = ENV["FACEBOOK_SECRET"]

#config/application.yml -> from Figaro
FACEBOOK_APP: 257669251071656
FACEBOOK_SECRET: 7b53604575d5dc0259466cfd41808c93

Figaro

I'd recommend using Figaro to keep your sensitive data behind closed doors. It allows you to create environment variables on both local & production environments

I think this should solve your issue, but it will definitely help to post your development.rb

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top