Problems Deploying a rails app to Heroku - ruby-on-rails-3

I am having problems deploying a Rails app to Heroku, I can't even run the Heroku console! (see below for the response I get from terminal)
I'm pretty new to rails and programming in general, so I don't really understand what the problem is here, would really appreciate some assistance!
/app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.0.8/lib/active_support/dependencies.rb:239:in `require': /app/config/environments/production.rb:3: unknown regexp options - lcal (SyntaxError)
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.0.8/lib/active_support/dependencies.rb:239:in `block in require'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.0.8/lib/active_support/dependencies.rb:225:in `block in load_dependency'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.0.8/lib/active_support/dependencies.rb:596:in `new_constants_in'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.0.8/lib/active_support/dependencies.rb:225:in `load_dependency'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.0.8/lib/active_support/dependencies.rb:239:in `require'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.0.8/lib/rails/application/bootstrap.rb:11:in `block in <module:Bootstrap>'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.0.8/lib/rails/initializable.rb:25:in `instance_exec'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.0.8/lib/rails/initializable.rb:25:in `run'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.0.8/lib/rails/initializable.rb:50:in `block in run_initializers'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.0.8/lib/rails/initializable.rb:49:in `each'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.0.8/lib/rails/initializable.rb:49:in `run_initializers'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.0.8/lib/rails/application.rb:134:in `initialize!'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.0.8/lib/rails/application.rb:77:in `method_missing'
from /app/config/environment.rb:7:in `<top (required)>'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.0.8/lib/active_support/dependencies.rb:239:in `require'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.0.8/lib/active_support/dependencies.rb:239:in `block in require'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.0.8/lib/active_support/dependencies.rb:225:in `block in load_dependency'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.0.8/lib/active_support/dependencies.rb:596:in `new_constants_in'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.0.8/lib/active_support/dependencies.rb:225:in `load_dependency'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.0.8/lib/active_support/dependencies.rb:239:in `require'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.0.8/lib/rails/application.rb:103:in `require_environment!'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.0.8/lib/rails/commands.rb:22:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
Here is config/environments./production.rb, I commented out line 3 as I thought that might be the issue, but I get the same problem whether it's commented, uncommented or deleted completely!
Pingpong::Application.configure do
# /opt/local/bin/convert
# Settings specified here will take precedence over those in config/application.rb
# The production environment is meant for finished, "live" apps.
# Code is not reloaded between requests
config.cache_classes = true
# Full error reports are disabled and caching is turned on
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
# Specifies the header that your server uses for sending files
config.action_dispatch.x_sendfile_header = "X-Sendfile"
# For nginx:
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
# If you have no front-end server that supports something like X-Sendfile,
# just comment this out and Rails will serve the files
# See everything in the log (default is :info)
# config.log_level = :debug
# Use a different logger for distributed setups
# config.logger = SyslogLogger.new
# Use a different cache store in production
# config.cache_store = :mem_cache_store
# Disable Rails's static asset server
# In production, Apache or nginx will already do this
config.serve_static_assets = false
# Enable serving of images, stylesheets, and javascripts from an asset server
# config.action_controller.asset_host = "http://assets.example.com"
# Disable delivery errors, bad email addresses will be ignored
# config.action_mailer.raise_delivery_errors = false
# Enable threaded mode
# config.threadsafe!
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation can not be found)
config.i18n.fallbacks = true
# Send deprecation notices to registered listeners
config.active_support.deprecation = :notify
end
/app/config/environment
# Load the rails application
require File.expand_path('../application', __FILE__)
# Initialize the rails application
Pingpong::Application.initialize!

The problem is line 3. Make sure you have committed your changes and then push them to Heroku.

Related

Selenium::WebDriver::Error::UnknownError: unknown error: session deleted because of page crash on rails application tested on codeship

Using Codeship as an automatic test plateform I have this error that occur only on codeship automatic run, not on my local environment, nor if I run the same test on codeship via ssh debug console :
Selenium::WebDriver::Error::UnknownError:
unknown error: session deleted because of page crash
from unknown error: cannot determine loading status
from tab crashed
(Session info: headless chrome=98.0.4758.102)
(Driver info: chromedriver=98.0.4758.102 (273bf7ac8c909cde36982d27f66f3c70846a3718-refs/branch-heads/4758#{#1151}),platform=Linux 5.4.0-1065-aws x86_64)
# /home/rof/cache/bundler/ruby/2.7.0/gems/selenium-webdriver-3.8.0/lib/selenium/webdriver/remote/response.rb:69:in `assert_ok'
# /home/rof/cache/bundler/ruby/2.7.0/gems/selenium-webdriver-3.8.0/lib/selenium/webdriver/remote/response.rb:32:in `initialize'
# /home/rof/cache/bundler/ruby/2.7.0/gems/selenium-webdriver-3.8.0/lib/selenium/webdriver/remote/http/common.rb:81:in `new'
# /home/rof/cache/bundler/ruby/2.7.0/gems/selenium-webdriver-3.8.0/lib/selenium/webdriver/remote/http/common.rb:81:in `create_response'
# /home/rof/cache/bundler/ruby/2.7.0/gems/selenium-webdriver-3.8.0/lib/selenium/webdriver/remote/http/default.rb:104:in `request'
# /home/rof/cache/bundler/ruby/2.7.0/gems/selenium-webdriver-3.8.0/lib/selenium/webdriver/remote/http/common.rb:59:in `call'
# /home/rof/cache/bundler/ruby/2.7.0/gems/selenium-webdriver-3.8.0/lib/selenium/webdriver/remote/bridge.rb:164:in `execute'
# /home/rof/cache/bundler/ruby/2.7.0/gems/selenium-webdriver-3.8.0/lib/selenium/webdriver/remote/oss/bridge.rb:579:in `execute'
# /home/rof/cache/bundler/ruby/2.7.0/gems/selenium-webdriver-3.8.0/lib/selenium/webdriver/remote/oss/bridge.rb:50:in `get'
# /home/rof/cache/bundler/ruby/2.7.0/gems/selenium-webdriver-3.8.0/lib/selenium/webdriver/common/navigation.rb:30:in `to'
# /home/rof/cache/bundler/ruby/2.7.0/gems/capybara-3.33.0/lib/capybara/selenium/driver.rb:71:in `visit'
# /home/rof/cache/bundler/ruby/2.7.0/gems/capybara-3.33.0/lib/capybara/session.rb:278:in `visit'
# /home/rof/cache/bundler/ruby/2.7.0/gems/capybara-3.33.0/lib/capybara/dsl.rb:53:in `call'
# /home/rof/cache/bundler/ruby/2.7.0/gems/capybara-3.33.0/lib/capybara/dsl.rb:53:in `visit'
# ./spec/features/authentications_spec.rb:17:in `block (2 levels) in <top (required)>'
# /home/rof/cache/bundler/ruby/2.7.0/gems/webmock-3.9.1/lib/webmock/rspec.rb:37:in `block (2 levels) in <top (required)>'
The headless configuration run is :
Capybara.register_driver :headless_chrome do |app|
client = Selenium::WebDriver::Remote::Http::Default.new
client.read_timeout = 120
options = ::Selenium::WebDriver::Chrome::Options.new()
options.add_argument 'headless'
options.add_argument('log-level=OFF')
options.add_argument('disable-dev-shm-usage') #The location of the shared memory file/dev/from shm/Move to tmp
options.add_argument('window-size=1024,768')
options.add_option('prefs', {'intl.accept_languages': 'en,en_US'})
options.add_option('w3c', false)
Capybara::Selenium::Driver.new app, browser: :chrome, options: options, http_client: client
end
Does someone have any clue on why it occurs? Or how I can find it out?

No Backtrace on request specs with Rspec

I have a request spec like this
require 'rails_helper'
describe 'People API' do
describe 'GET /api/v1/people/lookup.json?phone_number=PHONE_NUMBER', :wip do
it 'returns a 200 status code' do
auth_get '/api/v1/people/lookup.json', phone_number: '91900199'
expect(response.status).to eq(200)
end
end
end
and if the specs fail for some reason I just get a 500 status code in the response, and that's it, so I have to check the log/test.log file to get to know what went wrong, that is pretty annoying.
Why rspec is not showing the backtrace like in other types of specs?
Here is how I run my specs, notice that I include the -b option
$ rspec -b -t wip -f documentation
Run options: include {:wip=>true}
People API
GET /api/v1/people/lookup.json?phone_number=PHONE_NUMBER
returns a 200 status code
Failures:
1) People API GET /api/v1/people/lookup.json?phone_number=PHONE_NUMBER with an empty phone number returns a empty response
Failure/Error: expect(response.status).to eq(200)
expected: 200
got: 500
(compared using ==)
# /Users/fespinoza/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-expectations-3.0.1/lib/rspec/expectations/fail_with.rb:30:in `fail_with'
# /Users/fespinoza/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-expectations-3.0.1/lib/rspec/expectations/handler.rb:35:in `handle_failure'
# /Users/fespinoza/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-expectations-3.0.1/lib/rspec/expectations/handler.rb:48:in `handle_matcher'
# /Users/fespinoza/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-expectations-3.0.1/lib/rspec/expectations/expectation_target.rb:54:in `to'
# ./spec/requests/api/v1/people_spec.rb:15:in `block (4 levels) in <top (required)>'
# /Users/fespinoza/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-3.0.1/lib/rspec/core/example.rb:148:in `instance_exec'
# /Users/fespinoza/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-3.0.1/lib/rspec/core/example.rb:148:in `block in run'
# /Users/fespinoza/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-3.0.1/lib/rspec/core/example.rb:210:in `call'
# /Users/fespinoza/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-3.0.1/lib/rspec/core/example.rb:210:in `block (2 levels) in <class:Procsy>'
# /Users/fespinoza/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-rails-3.0.1/lib/rspec/rails/adapters.rb:68:in `block (2 levels) in <module:MinitestLifecycleAdapter>'
# /Users/fespinoza/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-3.0.1/lib/rspec/core/example.rb:294:in `instance_exec'
# /Users/fespinoza/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-3.0.1/lib/rspec/core/example.rb:294:in `instance_exec'
# /Users/fespinoza/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-3.0.1/lib/rspec/core/hooks.rb:430:in `block (2 levels) in run'
# /Users/fespinoza/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-3.0.1/lib/rspec/core/example.rb:210:in `call'
# /Users/fespinoza/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-3.0.1/lib/rspec/core/example.rb:210:in `block (2 levels) in <class:Procsy>'
# /Users/fespinoza/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-3.0.1/lib/rspec/core/hooks.rb:432:in `run'
# /Users/fespinoza/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-3.0.1/lib/rspec/core/hooks.rb:485:in `run'
# /Users/fespinoza/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-3.0.1/lib/rspec/core/example.rb:303:in `with_around_example_hooks'
# /Users/fespinoza/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-3.0.1/lib/rspec/core/example.rb:145:in `run'
# /Users/fespinoza/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-3.0.1/lib/rspec/core/example_group.rb:494:in `block in run_examples'
# /Users/fespinoza/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-3.0.1/lib/rspec/core/example_group.rb:490:in `map'
# /Users/fespinoza/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-3.0.1/lib/rspec/core/example_group.rb:490:in `run_examples'
# /Users/fespinoza/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-3.0.1/lib/rspec/core/example_group.rb:457:in `run'
# /Users/fespinoza/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-3.0.1/lib/rspec/core/example_group.rb:458:in `block in run'
# /Users/fespinoza/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-3.0.1/lib/rspec/core/example_group.rb:458:in `map'
# /Users/fespinoza/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-3.0.1/lib/rspec/core/example_group.rb:458:in `run'
# /Users/fespinoza/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-3.0.1/lib/rspec/core/example_group.rb:458:in `block in run'
# /Users/fespinoza/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-3.0.1/lib/rspec/core/example_group.rb:458:in `map'
# /Users/fespinoza/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-3.0.1/lib/rspec/core/example_group.rb:458:in `run'
# /Users/fespinoza/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-3.0.1/lib/rspec/core/runner.rb:112:in `block (2 levels) in run_specs'
# /Users/fespinoza/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-3.0.1/lib/rspec/core/runner.rb:112:in `map'
# /Users/fespinoza/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-3.0.1/lib/rspec/core/runner.rb:112:in `block in run_specs'
# /Users/fespinoza/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-3.0.1/lib/rspec/core/reporter.rb:54:in `report'
# /Users/fespinoza/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-3.0.1/lib/rspec/core/runner.rb:108:in `run_specs'
# /Users/fespinoza/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-3.0.1/lib/rspec/core/runner.rb:86:in `run'
# /Users/fespinoza/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-3.0.1/lib/rspec/core/runner.rb:70:in `run'
# /Users/fespinoza/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-3.0.1/lib/rspec/core/runner.rb:38:in `invoke'
# /Users/fespinoza/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-3.0.1/exe/rspec:4:in `<top (required)>'
# /Users/fespinoza/.rbenv/versions/2.1.1/bin/rspec:23:in `load'
# /Users/fespinoza/.rbenv/versions/2.1.1/bin/rspec:23:in `<main>'
Finished in 0.46863 seconds (files took 3.59 seconds to load)
1 examples, 1 failures
but it does not contain the real reason of the 500 error
Your request specs interact with your full stack, including middleware. When an error occurs inside one of your controller methods, it is caught higher up the stack so that a 500 error can be returned to the client. This is what you are seeing in the assertion failure.
You might be able to write your own middleware for testing purposes which prints errors to stderr if you really want this.

Ruby on Rails TDD Error with 'Bundle Exec Rspec'

I am working through Hartl's Ruby on Rails tutorial and am stuck on Section 3.2 where I am required to run a TDD using the command:
$bundle exec rspec/requests/static_pages_spec.rb
and I get this in return:
/home/Kelvin_Yu/rails_projects/sample_app/spec/requests/static_pages_spec.rb:1:in `require': /home/Kelvin_Yu/rails_projects/sample_app/spec/spec_helper.rb:2: syntax error, unexpected '.' (SyntaxError)
/home/Kelvin_Yu/rails_projects/sample_app/spec/spec_helper.rb:6: syntax error, unexpected '.'
from /home/Kelvin_Yu/rails_projects/sample_app/spec/requests/static_pages_spec.rb:1:in `<top (required)>'
from /usr/lib/ruby/gems/1.9.1/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `load'
from /usr/lib/ruby/gems/1.9.1/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `block in load_spec_files'
from /usr/lib/ruby/gems/1.9.1/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `map'
from /usr/lib/ruby/gems/1.9.1/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `load_spec_files'
from /usr/lib/ruby/gems/1.9.1/gems/rspec-core-2.11.1/lib/rspec/core/command_line.rb:22:in `run'
from /usr/lib/ruby/gems/1.9.1/gems/rspec-core-2.11.1/lib/rspec/core/runner.rb:69:in `run'
from /usr/lib/ruby/gems/1.9.1/gems/rspec-core-2.11.1/lib/rspec/core/runner.rb:8:in `block in autorun'
So I check in my "static_pages_spec.rb" file and see that it is the same as in Listing 3.9 in the tutorial (http://ruby.railstutorial.org/chapters/static-pages#sec-first_tests):
require 'spec_helper'
describe "Static pages" do
describe "Home page" do
it "should have the content 'Sample App'" do
visit '/static_pages/home'
expect(page).to have_content('Sample App')
end
end
end
So that makes me believe that this is not the cause of the error (please let me know if this assumption is incorrect) and I proceed to check my "spec_helper.rb" file:
# This file is copied to spec/ when you run 'rails generate rspec:install'
.
.
.
RSpec.configure do |config|
.
.
.
config.include Capybara::DSL
end
This is the same as shown in the tutorial (Listing 3.10 # http://ruby.railstutorial.org/chapters/static-pages#sec-first_tests).
Since the error is an "unexpected '.' (SyntaxError)", I remove the period from line 2 and rerun the Rspec command. I get the same error, so I remove all periods from that file so it is now:
# This file is copied to spec/ when you run 'rails generate rspec:install'
RSpec.configure do |config|
config.include Capybara::DSL
end
and get a different error:
/home/Kelvin_Yu/rails_projects/sample_app/spec/spec_helper.rb:3:in `block in <top (required)>': uninitialized constant Capybara (NameError)
from /usr/lib/ruby/gems/1.9.1/gems/rspec-core-2.11.1/lib/rspec/core.rb:92:in `configure'
from /home/Kelvin_Yu/rails_projects/sample_app/spec/spec_helper.rb:2:in `<top (required)>'
from /home/Kelvin_Yu/rails_projects/sample_app/spec/requests/static_pages_spec.rb:1:in `require'
from /home/Kelvin_Yu/rails_projects/sample_app/spec/requests/static_pages_spec.rb:1:in `<top (required)>'
from /usr/lib/ruby/gems/1.9.1/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `load'
from /usr/lib/ruby/gems/1.9.1/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `block in load_spec_files'
from /usr/lib/ruby/gems/1.9.1/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `map'
from /usr/lib/ruby/gems/1.9.1/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `load_spec_files'
from /usr/lib/ruby/gems/1.9.1/gems/rspec-core-2.11.1/lib/rspec/core/command_line.rb:22:in `run'
from /usr/lib/ruby/gems/1.9.1/gems/rspec-core-2.11.1/lib/rspec/core/runner.rb:69:in `run'
from /usr/lib/ruby/gems/1.9.1/gems/rspec-core-2.11.1/lib/rspec/core/runner.rb:8:in `block in autorun'
Not sure what this error "uninitialized constant Capybara (NameError)" means. Can anyone help advise what would be the next best steps?
Those dots in the author's examples are meant to serve as ellipses, indicating that there's text there that's not being shown (to keep the reader's focus on the relevant bits).
This is closer to what a your spec_helper.rb file should look like:
# This file is copied to spec/ when you run 'rails generate rspec:install'
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'rspec/autorun'
# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
#def logger
# Rails::logger
#end
RSpec.configure do |config|
# ## Mock Framework
#
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
#
# config.mock_with :mocha
# config.mock_with :flexmock
# config.mock_with :rr
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
config.fixture_path = "#{::Rails.root}/spec/fixtures"
# If you're not using ActiveRecord, or you'd prefer not to run each of your
# examples within a transaction, remove the following line or assign false
# instead of true.
config.use_transactional_fixtures = true
# If true, the base class of anonymous controllers will be inferred
# automatically. This will be the default behavior in future versions of
# rspec-rails.
config.infer_base_class_for_anonymous_controllers = false
# Run specs in random order to surface order dependencies. If you find an
# order dependency and want to debug it, you can fix the order by providing
# the seed, which is printed after each run.
# --seed 1234
config.order = "random"
end
If you haven't made any commits since you removed the extra lines, grab the previous (complete) version of this file from your github repo.

Unable to make S3DataSource work for Dragonfly Gem (Ruby 1.9.3)

As per draganfly documentation here
http://markevans.github.com/dragonfly/file.DataStorage.html
I added following code to my initializer/draganfly.rb
enter code here
app = Dragonfly[:my_app_name]
app.datastore = Dragonfly::DataStorage::S3DataStore.new
app.datastore.configure do |c|
c.bucket_name = 'my_bucket'
c.access_key_id = 'salfjasd34u23'
c.secret_access_key = '8u2u3rhkhfo23...'
c.region = 'eu-west-1' # defaults to 'us-east-1'
c.storage_headers = {'some' => 'thing'} # defaults to {'x-amz-acl' => 'public-read'}
c.url_scheme = 'https' # defaults to 'http'
end
I could not even start my server after adding code above. Here is the error I get in logs
Exiting
c:/Connect/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in
require: ca
not load such file -- fog (LoadError)
from c:/Connect/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-`enter code here`3.1.3/lib/active_support/dependencies.rb:240:in
block in require
from c:/Connect/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:223:in
block in load_dependency'
from c:/Connect/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:640:in
new_constants_in'
from c:/Connect/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:223:in
load_dependency'
from c:/Connect/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in
require'
from c:/Connect/Ruby193/lib/ruby/gems/1.9.1/gems/dragonfly-0.9.9/lib/dragonfly/data_storage/s3data_store.rb:1:i
`<top (required)>'
from c:/rail_projects/c4fx2/config/initializers/dragonfly.rb:4:in `<top (required)>'
from c:/Connect/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:234:in
load'
from c:/Connect/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:234:in
block in load'
Try adding gem 'fog' to your Gemfile.
Worked for me when trying to get S3 working with Dragonfly in a Sinatra app.
From looking through the Dragonfly source code, I found the S3 data store requires the fog gem and it wasn't being included in my Gemfile.lock. So I manually added it to the Gemfile.

Undefined method `omniauth' for Devise:Module (devise, omniauth, heroku, rails 3.0.3)

I have an app that uses Amazon Product Advertising API at local with no issues. In order to push it to Heroku, I have to change the version of the aws gem I use to make it work with Heroku ("treyconnell-ruby-aaws" v0.8.3) and that version limits me to Rails 3.0.3 and to devise v1.1.8 gems.
When I downgrade gems and 'bundle update', something breaks even at local, guessing omniauth and devise start fighting. The server fail to starts with the following error log.
I tried many different configurations of loading omniauth gem, oa-auth, requiring omniauth/oauth etc, still the same error. What might be the issue here?
PS. I have to use this aws gem for now.
/Users/eerdogan/Sites/myApp/config/initializers/devise.rb:17: undefined method `omniauth' for Devise:Module (NoMethodError)
from /Library/Ruby/Gems/1.8/gems/devise-1.1.8/lib/devise.rb:183:in `setup'
from /Users/eerdogan/Sites/myApp/config/initializers/devise.rb:3
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:235:in `load'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:235:in `load'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:225:in `load_dependency'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:596:in `new_constants_in'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:225:in `load_dependency'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:235:in `load'
from /Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/engine.rb:201
from /Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/engine.rb:200:in `each'
from /Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/engine.rb:200
from /Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/initializable.rb:25:in `instance_exec'
from /Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/initializable.rb:25:in `run'
from /Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/initializable.rb:50:in `run_initializers'
from /Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/initializable.rb:49:in `each'
from /Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/initializable.rb:49:in `run_initializers'
from /Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/application.rb:134:in `initialize!'
from /Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/application.rb:77:in `send'
from /Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/application.rb:77:in `method_missing'
from /Users/eerdogan/Sites/myApp/config/environment.rb:5
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in `require'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in `require'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:225:in `load_dependency'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:596:in `new_constants_in'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:225:in `load_dependency'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in `require'
from /Users/eerdogan/Sites/myApp/config.ru:3
from /Library/Ruby/Gems/1.8/gems/rack-1.2.4/lib/rack/builder.rb:46:in `instance_eval'
from /Library/Ruby/Gems/1.8/gems/rack-1.2.4/lib/rack/builder.rb:46:in `initialize'
from /Users/eerdogan/Sites/myApp/config.ru:1:in `new'
from /Users/eerdogan/Sites/myApp/config.ru:1
Edit: here is the devise.rb file:
# Use this hook to configure devise mailer, warden hooks and so forth. The first
# four configuration values can also be set straight in your models.
Devise.setup do |config|
config.mailer_sender = "please-change-me-at-config-initializers-devise#example.com"
require 'devise/orm/active_record'
config.omniauth :facebook, "1*************", "3******************************"
config.case_insensitive_keys = [ :email ]
config.stretches = 10
config.use_salt_as_remember_token = true
config.reset_password_within = 2.hours
end
I think the config.facebook line in devise.rb is causing you the grief.
I took a look at my devise.rb and I also have another file called omniauth.rb.
(1) My devise.rb does not have the config.facebook line. Try removing that and see if it works.
(2) I have a file called omniauth.rb, located in the same directory as devise.rb. I'm pasting it below:
require 'openid/store/filesystem'
Rails.application.config.middleware.use OmniAuth::Builder do
case Rails.env
when "development"
provider :facebook, 'XXX', 'XXXX' , {:scope => 'manage_pages,publish_stream,offline_access,email'}
when "production"
provider :facebook, 'XXX', 'XXXX', {:scope => 'manage_pages,publish_stream,offline_access,email', :client_options => {:ssl => {:ca_file => '/usr/lib/ssl/certs/ca-certificates.crt'}}}
end
end
See if this works out for you. :)