"rails activestorage:update" errors out while upgrading to rails 6 - ruby-on-rails

I am performing an upgrade in rails version from 5.2.3 to 6.0.0 in our application and ended up with the following error when I run rails app:update and accept default changes.
Overwrite /Users/pk064816/solemnity/bin/setup? (enter "h" for help) [Ynaqdhm] y
force bin/setup
identical bin/yarn
rails active_storage:update
/Users/pk064816/.rvm/gems/ruby-2.6.3/gems/rule_monger-0.3.0/lib/rule_monger.rb:17: warning: already initialized constant HOST_PORT
/Users/pk064816/.rvm/gems/ruby-2.6.3/gems/netapp_oncommand_rest-0.2.1/lib/netapp_oncommand_rest.rb:21: warning: previous definition of HOST_PORT was here
rails aborted!
NameError: wrong constant name [[:error, ["detected unsupported rails version 6.0.0"], nil]]
/Users/pk064816/.rvm/gems/ruby-2.6.3/gems/newrelic_rpm-5.7.0.350/lib/new_relic/control/class_methods.rb:52:in `const_get'
/Users/pk064816/.rvm/gems/ruby-2.6.3/gems/newrelic_rpm-5.7.0.350/lib/new_relic/control/class_methods.rb:52:in `load_framework_class'
/Users/pk064816/.rvm/gems/ruby-2.6.3/gems/newrelic_rpm-5.7.0.350/lib/new_relic/control/class_methods.rb:32:in `new_instance'
/Users/pk064816/.rvm/gems/ruby-2.6.3/gems/newrelic_rpm-5.7.0.350/lib/new_relic/control/class_methods.rb:13:in `instance'
/Users/pk064816/.rvm/gems/ruby-2.6.3/gems/newrelic_rpm-5.7.0.350/lib/newrelic_rpm.rb:41:in `block in <class:Railtie>'
/Users/pk064816/.rvm/gems/ruby-2.6.3/gems/railties-6.0.0/lib/rails/initializable.rb:32:in `instance_exec'
/Users/pk064816/.rvm/gems/ruby-2.6.3/gems/railties-6.0.0/lib/rails/initializable.rb:32:in `run'
/Users/pk064816/.rvm/gems/ruby-2.6.3/gems/railties-6.0.0/lib/rails/initializable.rb:61:in `block in run_initializers'
/Users/pk064816/.rvm/gems/ruby-2.6.3/gems/railties-6.0.0/lib/rails/initializable.rb:60:in `run_initializers'
/Users/pk064816/.rvm/gems/ruby-2.6.3/gems/railties-6.0.0/lib/rails/application.rb:363:in `initialize!'
/Users/pk064816/ClosedStack/config/environment.rb:5:in `<main>'
/Users/pk064816/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
/Users/pk064816/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
/Users/pk064816/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
/Users/pk064816/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
/Users/pk064816/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
/Users/pk064816/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:325:in `block in require'
/Users/pk064816/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:291:in `load_dependency'
/Users/pk064816/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:325:in `require'
/Users/pk064816/.rvm/gems/ruby-2.6.3/gems/railties-6.0.0/lib/rails/application.rb:339:in `require_environment!'
/Users/pk064816/.rvm/gems/ruby-2.6.3/gems/railties-6.0.0/lib/rails/application.rb:515:in `block in run_tasks_blocks'
/Users/pk064816/.rvm/gems/ruby-2.6.3/gems/railties-6.0.0/lib/rails/commands/rake/rake_command.rb:23:in `block in perform'
/Users/pk064816/.rvm/gems/ruby-2.6.3/gems/railties-6.0.0/lib/rails/commands/rake/rake_command.rb:20:in `perform'
/Users/pk064816/.rvm/gems/ruby-2.6.3/gems/railties-6.0.0/lib/rails/command.rb:48:in `invoke'
/Users/pk064816/.rvm/gems/ruby-2.6.3/gems/railties-6.0.0/lib/rails/commands.rb:18:in `<main>'
/Users/pk064816/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
/Users/pk064816/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
/Users/pk064816/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
/Users/pk064816/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
/Users/pk064816/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
/Users/pk064816/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:325:in `block in require'
/Users/pk064816/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:291:in `load_dependency'
/Users/pk064816/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:325:in `require'
bin/rails:8:in `<main>'
Tasks: TOP => active_storage:update => environment
(See full trace by running task with --trace)
After this, check Rails upgrade guide at https://guides.rubyonrails.org/upgrading_ruby_on_rails.html for more details about upgrading your app.
I do not really make use of activestorage inside the application and any configs specific to activestorage are only the defaults obtained from rails 5.2.3.
Here's what I have in my bin/rails:
#!/usr/bin/env ruby
begin
load File.expand_path("../spring", __FILE__)
rescue LoadError
end
APP_PATH = File.expand_path('../config/application', __dir__)
require_relative '../config/boot'
require 'rails/commands'
and in bin/setup:
#!/usr/bin/env ruby
require 'fileutils'
# path to your application root.
APP_ROOT = File.expand_path('..', __dir__)
def system!(*args)
system(*args) || abort("\n== Command #{args} failed ==")
end
FileUtils.chdir APP_ROOT do
# This script is a way to setup or update your development environment automatically.
# This script is idempotent, so that you can run it at anytime and get an expectable outcome.
# Add necessary setup steps to this file.
puts '== Installing dependencies =='
system! 'gem install bundler --conservative'
system('bundle check') || system!('bundle install')
# Install JavaScript dependencies
# system('bin/yarn')
# puts "\n== Copying sample files =="
# unless File.exist?('config/database.yml')
# FileUtils.cp 'config/database.yml.sample', 'config/database.yml'
# end
puts "\n== Preparing database =="
system! 'bin/rails db:prepare'
puts "\n== Removing old logs and tempfiles =="
system! 'bin/rails log:clear tmp:clear'
puts "\n== Restarting application server =="
system! 'bin/rails restart'
end
and config/application.rb
require_relative 'boot'
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module Solemnity
class Application < Rails::Application
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
# config.time_zone = 'Central Time (US & Canada)'
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
# Use Resque for our Active::Jobs
config.active_job.queue_adapter = :resque
# Add lib to autoload path
config.eager_load_paths << "#{Rails.root}/lib"
config.time_zone = 'Central Time (US & Canada)'
config.exceptions_app = self.routes
end
end
I tried to disable the use of activestorage, but that didn't really work! I am not entirely sure what's causing an error here and would really appreciate any help in working around this problem!

Related

warning: shebang line ending with \r may cause problems. rails aborted

I am setting up an existence Rails project using rbenv on Ubuntu 18.04. rbenv version is 1.1.2-11-gc46a970.
I have added .ruby-version file in the project root. When I run rbenv version I get the correct version of Ruby.
Now the issue is when I run rails s or rails test:system I get the following error:
/home/user/.rbenv/versions/2.5.0/bin/ruby: warning: shebang line ending with \r may cause problems rails aborted!
NameError: uninitialized constant URI::Generic
/home/my_project/config/application.rb:3:in `require'
/home/my_project/config/application.rb:3:in `<top (required)>'
/home/my_project/Rakefile:4:in `require_relative'
/home/my_project/Rakefile:4:in `<top (required)>'
/home/my_project/bin/rails:9:in `require'
/home/my_project/bin/rails:9:in `<top (required)>'
/home/my_project/bin/spring:15:in `<top (required)>'
bin/rails:3:in `load'
bin/rails:3:in `<main>'
(See full trace by running task with --trace)
But I am unable to get any clue how to fix this (as I am new to Ruby Rails.)
EDIT
require File.expand_path('../boot', __FILE__)
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module Dingoapp
class Application < Rails::Application
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
config.time_zone = 'London'
config.serve_static_files = true
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
end
end

Error after upgrading mongoid 4.0.1 to 5.1.0

I upgraded Mongoid and when I run my server, I get the following error. In fact, when I run anything like console, I get the same error:
/Users/SupremeA/.rvm/gems/ruby-2.2.1/gems/mongoid-5.1.1/lib/mongoid/railtie.rb:49:in `<class:Railtie>': uninitialized constant Mongoid::Config (NameError)
from /Users/SupremeA/.rvm/gems/ruby-2.2.1/gems/mongoid-5.1.1/lib/mongoid/railtie.rb:12:in `<module:Mongoid>'
from /Users/SupremeA/.rvm/gems/ruby-2.2.1/gems/mongoid-5.1.1/lib/mongoid/railtie.rb:7:in `<module:Rails>'
from /Users/SupremeA/.rvm/gems/ruby-2.2.1/gems/mongoid-5.1.1/lib/mongoid/railtie.rb:6:in `<top (required)>'
from /Users/SupremeA/rails-dev-box/code/True_Numbers/config/application.rb:5:in `require'
from /Users/SupremeA/rails-dev-box/code/True_Numbers/config/application.rb:5:in `<top (required)>'
from /Users/SupremeA/.rvm/gems/ruby-2.2.1/gems/railties-4.0.10/lib/rails/commands.rb:43:in `require'
from /Users/SupremeA/.rvm/gems/ruby-2.2.1/gems/railties-4.0.10/lib/rails/commands.rb:43:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
It seems to be a problem with Railties but I cant seem to see how to fix it.
application.rb
require File.expand_path('../boot', __FILE__)
require "action_controller/railtie"
require "action_mailer/railtie"
require "mongoid/railtie"
#require "active_resource/railtie" # Comment this line for Rails 4.0+
require "rails/test_unit/railtie"
require "sprockets/railtie" # Uncomment this line for Rails 3.1+
#require 'rails/all'
#config.filter_parameters += [:password, :password_confirmation]
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module AppName
class Application < Rails::Application
Mongoid.logger.level = Logger::DEBUG
Moped.logger.level = Logger::DEBUG
#load vendor files
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
# config.time_zone = 'Central Time (US & Canada)'
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
end
end
--UPDATE--
New error after removing the railties line from the application.rb
.../AppName/config/application.rb:19:in `<class:Application>': uninitialized constant AppName::Application::Moped (NameError)
from /Users/SupremeA/rails-dev-box/code/AppName/config/application.rb:17:in `<module:AppName>'
from /Users/SupremeA/rails-dev-box/code/AppName/config/application.rb:16:in `<top (required)>'
from /Users/SupremeA/.rvm/gems/ruby-2.2.1/gems/railties-4.0.10/lib/rails/commands.rb:74:in `require'
from /Users/SupremeA/.rvm/gems/ruby-2.2.1/gems/railties-4.0.10/lib/rails/commands.rb:74:in `block in <top (required)>'
from /Users/SupremeA/.rvm/gems/ruby-2.2.1/gems/railties-4.0.10/lib/rails/commands.rb:71:in `tap'
from /Users/SupremeA/.rvm/gems/ruby-2.2.1/gems/railties-4.0.10/lib/rails/commands.rb:71:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
I dont think you need this line in your application.rb:
require "mongoid/railtie"
Just remove it and it should work.
also remove this line:
Moped.logger.level = Logger::DEBUG
according to the mongoid docs, if you want to edit logger config, use this:
Mongoid.logger.level = Logger::DEBUG
Mongo::Logger.logger.level = Logger::DEBUG

Why is my Rails server not working?

When I try to start my Rails server, using the rails server command, I get many errors. How do I fix them?
/home/action/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/psych.rb:205:in `parse': (<unknown>): mapping values are not allowed in this context at line 6 column 15 (Psych::SyntaxError)
from /home/action/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/psych.rb:205:in `parse_stream'
from /home/action/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/psych.rb:153:in `parse'
from /home/action/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/psych.rb:129:in `load'
from /home/action/.rvm/gems/ruby-2.0.0-p353#learn-rails/gems/figaro-0.7.0/lib/figaro.rb:21:in `raw'
from /home/action/.rvm/gems/ruby-2.0.0-p353#learn-rails/gems/figaro-0.7.0/lib/figaro.rb:17:in `env'
from /home/action/.rvm/gems/ruby-2.0.0-p353#learn-rails/gems/figaro-0.7.0/lib/figaro/railtie.rb:7:in `block in <class:Railtie>'
from /home/action/.rvm/gems/ruby-2.0.0-p353#learn-rails/gems/activesupport-4.0.2/lib/active_support/lazy_load_hooks.rb:36:in `call'
from /home/action/.rvm/gems/ruby-2.0.0-p353#learn-rails/gems/activesupport-4.0.2/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
from /home/action/.rvm/gems/ruby-2.0.0-p353#learn-rails/gems/activesupport-4.0.2/lib/active_support/lazy_load_hooks.rb:45:in `block in run_load_hooks'
from /home/action/.rvm/gems/ruby-2.0.0-p353#learn-rails/gems/activesupport-4.0.2/lib/active_support/lazy_load_hooks.rb:44:in `each'
from /home/action/.rvm/gems/ruby-2.0.0-p353#learn-rails/gems/activesupport-4.0.2/lib/active_support/lazy_load_hooks.rb:44:in `run_load_hooks'
from /home/action/.rvm/gems/ruby-2.0.0-p353#learn-rails/gems/railties-4.0.2/lib/rails/application.rb:67:in `inherited'
from /home/action/workspace/learn-rails/config/application.rb:10:in `<module:LearnRails>'
from /home/action/workspace/learn-rails/config/application.rb:9:in `<top (required)>'
from /home/action/.rvm/gems/ruby-2.0.0-p353#learn-rails/gems/railties-4.0.2/lib/rails/commands.rb:74:in `require'
from /home/action/.rvm/gems/ruby-2.0.0-p353#learn-rails/gems/railties-4.0.2/lib/rails/commands.rb:74:in `block in <top (required)>'
from /home/action/.rvm/gems/ruby-2.0.0-p353#learn-rails/gems/railties-4.0.2/lib/rails/commands.rb:71:in `tap'
from /home/action/.rvm/gems/ruby-2.0.0-p353#learn-rails/gems/railties-4.0.2/lib/rails/commands.rb:71:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
Here is application.rb file code:
require File.expand_path('../boot', __FILE__)
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(:default, Rails.env)
module LearnRails
class Application < Rails::Application
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
# config.time_zone = 'Central Time (US & Canada)'
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
end
end
LAST EDIT
Thank you, it was weird problem with application.yml file! Now it works like a charm!
This seems like an error with figaro gem. the Psych::SyntaxError suggests your application.yml file may be the problem.

rails 4.1 beta upgrade 'action-view no method error'

I am trying to upgrade my rails application from rails 4.0.2 to 4.1 beta, I followed all the instructions given on http://edgeguides.rubyonrails.org/4_1_release_notes.html#action-pack-removals .
Whenever i run my application, this is the error i get
/Users/surendra/.rvm/gems/ruby-1.9.3-p448/gems/railties-4.1.0.beta1/lib/rails/railtie/configuration.rb:95:in `method_missing': undefined method `action_view' for # (NoMethodError)
from /Users/surendra/.rvm/gems/ruby-1.9.3-p448/gems/jquery-rails-3.0.4/lib/jquery/rails/railtie.rb:7:in `block in '
from /Users/surendra/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-4.1.0.beta1/lib/active_support/lazy_load_hooks.rb:36:in `call'
from /Users/surendra/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-4.1.0.beta1/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
from /Users/surendra/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-4.1.0.beta1/lib/active_support/lazy_load_hooks.rb:45:in `block in run_load_hooks'
from /Users/surendra/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-4.1.0.beta1/lib/active_support/lazy_load_hooks.rb:44:in `each'
from /Users/surendra/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-4.1.0.beta1/lib/active_support/lazy_load_hooks.rb:44:in `run_load_hooks'
from /Users/surendra/.rvm/gems/ruby-1.9.3-p448/gems/railties-4.1.0.beta1/lib/rails/application.rb:121:in `initialize'
from /Users/surendra/.rvm/gems/ruby-1.9.3-p448/gems/railties-4.1.0.beta1/lib/rails/railtie.rb:171:in `new'
from /Users/surendra/.rvm/gems/ruby-1.9.3-p448/gems/railties-4.1.0.beta1/lib/rails/railtie.rb:171:in `instance'
from /Users/surendra/.rvm/gems/ruby-1.9.3-p448/gems/railties-4.1.0.beta1/lib/rails/application.rb:90:in `inherited'
from /Users/surendra/Desktop/faces/config/application.rb:13:in `'
from /Users/surendra/Desktop/faces/config/application.rb:12:in `'
from /Users/surendra/.rvm/gems/ruby-1.9.3-p448/gems/railties-4.1.0.beta1/lib/rails/commands/commands_tasks.rb:79:in `require'
from /Users/surendra/.rvm/gems/ruby-1.9.3-p448/gems/railties-4.1.0.beta1/lib/rails/commands/commands_tasks.rb:79:in `block in server'
from /Users/surendra/.rvm/gems/ruby-1.9.3-p448/gems/railties-4.1.0.beta1/lib/rails/commands/commands_tasks.rb:76:in `tap'
from /Users/surendra/.rvm/gems/ruby-1.9.3-p448/gems/railties-4.1.0.beta1/lib/rails/commands/commands_tasks.rb:76:in `server'
from /Users/surendra/.rvm/gems/ruby-1.9.3-p448/gems/railties-4.1.0.beta1/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
from /Users/surendra/.rvm/gems/ruby-1.9.3-p448/gems/railties-4.1.0.beta1/lib/rails/commands.rb:17:in `'
from bin/rails:4:in `require'
from bin/rails:4:in `'
my application.rb file is this
require File.expand_path('../boot', __FILE__)
require "action_controller/railtie"
require "rails/test_unit/railtie"
require "sprockets/railtie"
Bundler.require(:default, Rails.env)
module ElitmusFaces
class Application < Rails::Application
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
# config.time_zone = 'Central Time (US & Canada)'
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
end
end
Can you help me with this error,i would like to know where the error occured
I finally solved this problem, since I was not following rails convention in application.rb, I had to dig deeper to find where the problem is. It looks like the problem is caused by
require "action_controller/railtie"
And the error it is showing is, actionview method not found. So I just replaced that line with
require "action_view/railtie"
I got this info from
https://github.com/rails/rails/pull/7356
it seems that actionview is decoupled from actionpack, so i needed to add it myself.

Rake: no such file to load -- xpath

How do I resolve the following error?
bundle exec rake db:create
rake aborted!
no such file to load -- xpath
/Users/michael/Sites/appsbar/config/application.rb:13:in `<top (required)>'
/Users/michael/Sites/appsbar/Rakefile:5:in `require'
/Users/michael/Sites/appsbar/Rakefile:5:in `<top (required)>'
with trace
bundle exec rake db:create --trace
rake aborted!
no such file to load -- xpath
/Users/michael/.rbenv/versions/1.9.2-p290/gemsets/appsbar/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `require'
/Users/michael/.rbenv/versions/1.9.2-p290/gemsets/appsbar/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `block in require'
/Users/michael/.rbenv/versions/1.9.2-p290/gemsets/appsbar/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:236:in `load_dependency'
/Users/michael/.rbenv/versions/1.9.2-p290/gemsets/appsbar/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `require'
/Users/michael/.rbenv/versions/1.9.2-p290/gemsets/appsbar/gems/capybara-2.0.1/lib/capybara.rb:3:in `<top (required)>'
/Users/michael/.rbenv/versions/1.9.2-p290/gemsets/appsbar/gems/bundler-1.2.2/lib/bundler/runtime.rb:68:in `require'
/Users/michael/.rbenv/versions/1.9.2-p290/gemsets/appsbar/gems/bundler-1.2.2/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
/Users/michael/.rbenv/versions/1.9.2-p290/gemsets/appsbar/gems/bundler-1.2.2/lib/bundler/runtime.rb:66:in `each'
/Users/michael/.rbenv/versions/1.9.2-p290/gemsets/appsbar/gems/bundler-1.2.2/lib/bundler/runtime.rb:66:in `block in require'
/Users/michael/.rbenv/versions/1.9.2-p290/gemsets/appsbar/gems/bundler-1.2.2/lib/bundler/runtime.rb:55:in `each'
/Users/michael/.rbenv/versions/1.9.2-p290/gemsets/appsbar/gems/bundler-1.2.2/lib/bundler/runtime.rb:55:in `require'
/Users/michael/.rbenv/versions/1.9.2-p290/gemsets/appsbar/gems/bundler-1.2.2/lib/bundler.rb:128:in `require'
/Users/michael/Sites/appsbar/config/application.rb:13:in `<top (required)>'
/Users/michael/Sites/appsbar/Rakefile:5:in `require'
/Users/michael/Sites/appsbar/Rakefile:5:in `<top (required)>'
/Users/michael/.rbenv/versions/1.9.2-p290/gemsets/appsbar/gems/rake-10.0.2/lib/rake/rake_module.rb:25:in `load'
/Users/michael/.rbenv/versions/1.9.2-p290/gemsets/appsbar/gems/rake-10.0.2/lib/rake/rake_module.rb:25:in `load_rakefile'
/Users/michael/.rbenv/versions/1.9.2-p290/gemsets/appsbar/gems/rake-10.0.2/lib/rake/application.rb:581:in `raw_load_rakefile'
/Users/michael/.rbenv/versions/1.9.2-p290/gemsets/appsbar/gems/rake-10.0.2/lib/rake/application.rb:87:in `block in load_rakefile'
/Users/michael/.rbenv/versions/1.9.2-p290/gemsets/appsbar/gems/rake-10.0.2/lib/rake/application.rb:158:in `standard_exception_handling'
/Users/michael/.rbenv/versions/1.9.2-p290/gemsets/appsbar/gems/rake-10.0.2/lib/rake/application.rb:86:in `load_rakefile'
/Users/michael/.rbenv/versions/1.9.2-p290/gemsets/appsbar/gems/rake-10.0.2/lib/rake/application.rb:70:in `block in run'
/Users/michael/.rbenv/versions/1.9.2-p290/gemsets/appsbar/gems/rake-10.0.2/lib/rake/application.rb:158:in `standard_exception_handling'
/Users/michael/.rbenv/versions/1.9.2-p290/gemsets/appsbar/gems/rake-10.0.2/lib/rake/application.rb:68:in `run'
/Users/michael/.rbenv/versions/1.9.2-p290/gemsets/appsbar/gems/rake-10.0.2/bin/rake:37:in `<top (required)>'
/Users/michael/.rbenv/versions/1.9.2-p290/gemsets/appsbar/bin/rake:19:in `load'
/Users/michael/.rbenv/versions/1.9.2-p290/gemsets/appsbar/bin/rake:19:in `<main>'
application.rb
require File.expand_path('../boot', __FILE__)
# Pick the frameworks you want:
require "active_record/railtie"
require "action_controller/railtie"
require "action_mailer/railtie"
require "active_resource/railtie"
require "sprockets/railtie"
# require "rails/test_unit/railtie"
if defined?(Bundler)
# If you precompile assets before deploying to production, use this line
Bundler.require(*Rails.groups(:assets => %w(development test)))
# If you want your assets lazily compiled in production, use this line
# Bundler.require(:default, :assets, Rails.env)
end
module Appsbar
class Application < Rails::Application
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
# Custom directories with classes and modules you want to be autoloadable.
# config.autoload_paths += %W(#{config.root}/extras)
# Only load the plugins named here, in the order given (default is alphabetical).
# :all can be used as a placeholder for all plugins not explicitly named.
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
# Activate observers that should always be running.
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
# config.time_zone = 'Central Time (US & Canada)'
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
# Configure the default encoding used in templates for Ruby 1.9.
config.encoding = "utf-8"
# Configure sensitive parameters which will be filtered from the log file.
config.filter_parameters += [:password]
# Enable escaping HTML in JSON.
config.active_support.escape_html_entities_in_json = true
# Use SQL instead of Active Record's schema dumper when creating the database.
# This is necessary if your schema can't be completely dumped by the schema dumper,
# like if you have constraints or database-specific column types
# config.active_record.schema_format = :sql
# Enforce whitelist mode for mass assignment.
# This will create an empty whitelist of attributes available for mass-assignment for all models
# in your app. As such, your models will need to explicitly whitelist or blacklist accessible
# parameters by using an attr_accessible or attr_protected declaration.
config.active_record.whitelist_attributes = true
# Enable the asset pipeline
config.assets.enabled = true
# Version of your assets, change this if you want to expire all your assets
config.assets.version = '1.0'
# Devise recommendation:
# If you are deploying Rails 3.1 on Heroku, you may want to set:
# config.assets.initialize_on_precompile = false
# On config/application.rb forcing your application to not access the DB
# or load models when precompiling your assets.
config.assets.initialize_on_precompile = false
end
end
Rakefile
#!/usr/bin/env rake
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require File.expand_path('../config/application', __FILE__)
Appsbar::Application.load_tasks
See
https://github.com/jnicklas/capybara/issues/882
Some people have fixed this issue by redoing "bundle update capybara", this appears to fix some kind of bundler dependency weirdness.
/full/path/to/the/gem/being/used/bin/gem install 'xpath' please ensure you're using the right gem binary, for example, my ruby install is in $HOME/.rvm/bin/ruby and gem is in $HOME/.rvm/gems/ruby-1.9.3-p327/bin. It's also to be found in /usr/bin. I always run it as $HOME/.rvm/gems/ruby-1.9.3-p327/bin/ruby $HOME/.rvm/gems/ruby-1.9.3-p327/bin/gem to not be ambiguous and to ensure I'm getting the right one.

Resources