My mongoid.yml:
production:
sessions:
default:
database: kvallspressen_production
hosts:
- localhost:27017
options:
options:
development:
# Configure available database sessions. (required)
sessions:
# Defines the default session. (required)
default:
# Defines the name of the default database that Mongoid can connect to.
# (required).
database: kvallspressen_development
# Provides the hosts the default session can connect to. Must be an array
# of host:port pairs. (required)
hosts:
- localhost:27017
options:
# Change whether the session persists in safe mode by default.
# (default: false)
# safe: false
# Change the default consistency model to :eventual or :strong.
# :eventual will send reads to secondaries, :strong sends everything
# to master. (default: :eventual)
# consistency: :eventual
# How many times Moped should attempt to retry an operation after
# failure. (default: 30)
# max_retries: 30
# The time in seconds that Moped should wait before retrying an
# operation on failure. (default: 1)
# retry_interval: 1
# Configure Mongoid specific options. (optional)
options:
# Configuration for whether or not to allow access to fields that do
# not have a field definition on the model. (default: true)
# allow_dynamic_fields: true
# Enable the identity map, needed for eager loading. (default: false)
# identity_map_enabled: false
# Includes the root model name in json serialization. (default: false)
# include_root_in_json: false
# Include the _type field in serializaion. (default: false)
# include_type_for_serialization: false
# Preload all models in development, needed when models use
# inheritance. (default: false)
# preload_models: false
# Protect id and type from mass assignment. (default: true)
# protect_sensitive_fields: true
# Raise an error when performing a #find and the document is not found.
# (default: true)
# raise_not_found_error: true
# Raise an error when defining a scope with the same name as an
# existing method. (default: false)
# scope_overwrite_exception: false
# Skip the database version check, used when connecting to a db without
# admin access. (default: false)
# skip_version_check: false
# User Active Support's time zone in conversions. (default: true)
# use_activesupport_time_zone: true
# Ensure all times are UTC in the app side. (default: false)
# use_utc: false
test:
sessions:
default:
database: kvallspressen_test
hosts:
- localhost:27017
options:
consistency: :strong
# In the test environment we lower the retries and retry interval to
# low amounts for fast failures.
max_retries: 1
retry_interval: 0
When I run RAILS_ENV=production rake db:create
I receive this error:
** Invoke db:create (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
undefined method `has_key?' for nil:NilClass
/usr/local/lib/ruby/gems/2.0.0/gems/mongoid-3.0.23/lib/mongoid/config/validators/session.rb:99:in `no_database_or_uri?'
/usr/local/lib/ruby/gems/2.0.0/gems/mongoid-3.0.23/lib/mongoid/config/validators/session.rb:45:in `validate_session_database'
/usr/local/lib/ruby/gems/2.0.0/gems/mongoid-3.0.23/lib/mongoid/config/validators/session.rb:25:in `block in validate'
/usr/local/lib/ruby/gems/2.0.0/gems/mongoid-3.0.23/lib/mongoid/config/validators/session.rb:24:in `each_pair'
/usr/local/lib/ruby/gems/2.0.0/gems/mongoid-3.0.23/lib/mongoid/config/validators/session.rb:24:in `validate'
/usr/local/lib/ruby/gems/2.0.0/gems/mongoid-3.0.23/lib/mongoid/config.rb:183:in `sessions='
/usr/local/lib/ruby/gems/2.0.0/gems/mongoid-3.0.23/lib/mongoid/config.rb:213:in `load_configuration'
/usr/local/lib/ruby/gems/2.0.0/gems/mongoid-3.0.23/lib/mongoid/config.rb:85:in `load!'
/usr/local/lib/ruby/gems/2.0.0/gems/mongoid-3.0.23/lib/mongoid.rb:146:in `load!'
/usr/local/lib/ruby/gems/2.0.0/gems/mongoid-3.0.23/lib/mongoid/railtie.rb:67:in `block in <class:Railtie>'
/usr/local/lib/ruby/gems/2.0.0/gems/railties-3.2.12/lib/rails/initializable.rb:30:in `instance_exec'
/usr/local/lib/ruby/gems/2.0.0/gems/railties-3.2.12/lib/rails/initializable.rb:30:in `run'
/usr/local/lib/ruby/gems/2.0.0/gems/railties-3.2.12/lib/rails/initializable.rb:55:in `block in run_initializers'
/usr/local/lib/ruby/gems/2.0.0/gems/railties-3.2.12/lib/rails/initializable.rb:54:in `each'
/usr/local/lib/ruby/gems/2.0.0/gems/railties-3.2.12/lib/rails/initializable.rb:54:in `run_initializers'
/usr/local/lib/ruby/gems/2.0.0/gems/railties-3.2.12/lib/rails/application.rb:136:in `initialize!'
/usr/local/lib/ruby/gems/2.0.0/gems/railties-3.2.12/lib/rails/railtie/configurable.rb:30:in `method_missing'
/var/www/kvallspressen/config/environment.rb:5:in `<top (required)>'
/usr/local/lib/ruby/gems/2.0.0/gems/railties-3.2.12/lib/rails/application.rb:103:in `require'
/usr/local/lib/ruby/gems/2.0.0/gems/railties-3.2.12/lib/rails/application.rb:103:in `require_environment!'
/usr/local/lib/ruby/gems/2.0.0/gems/railties-3.2.12/lib/rails/application.rb:297:in `block (2 levels) in initialize_tasks'
/usr/local/lib/ruby/gems/2.0.0/gems/rake-10.0.3/lib/rake/task.rb:228:in `call'
/usr/local/lib/ruby/gems/2.0.0/gems/rake-10.0.3/lib/rake/task.rb:228:in `block in execute'
/usr/local/lib/ruby/gems/2.0.0/gems/rake-10.0.3/lib/rake/task.rb:223:in `each'
/usr/local/lib/ruby/gems/2.0.0/gems/rake-10.0.3/lib/rake/task.rb:223:in `execute'
/usr/local/lib/ruby/gems/2.0.0/gems/rake-10.0.3/lib/rake/task.rb:166:in `block in invoke_with_call_chain'
/usr/local/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
/usr/local/lib/ruby/gems/2.0.0/gems/rake-10.0.3/lib/rake/task.rb:159:in `invoke_with_call_chain'
/usr/local/lib/ruby/gems/2.0.0/gems/rake-10.0.3/lib/rake/task.rb:187:in `block in invoke_prerequisites'
/usr/local/lib/ruby/gems/2.0.0/gems/rake-10.0.3/lib/rake/task.rb:185:in `each'
/usr/local/lib/ruby/gems/2.0.0/gems/rake-10.0.3/lib/rake/task.rb:185:in `invoke_prerequisites'
/usr/local/lib/ruby/gems/2.0.0/gems/rake-10.0.3/lib/rake/task.rb:165:in `block in invoke_with_call_chain'
/usr/local/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
/usr/local/lib/ruby/gems/2.0.0/gems/rake-10.0.3/lib/rake/task.rb:159:in `invoke_with_call_chain'
/usr/local/lib/ruby/gems/2.0.0/gems/rake-10.0.3/lib/rake/task.rb:152:in `invoke'
/usr/local/lib/ruby/gems/2.0.0/gems/rake-10.0.3/lib/rake/application.rb:143:in `invoke_task'
/usr/local/lib/ruby/gems/2.0.0/gems/rake-10.0.3/lib/rake/application.rb:101:in `block (2 levels) in top_level'
/usr/local/lib/ruby/gems/2.0.0/gems/rake-10.0.3/lib/rake/application.rb:101:in `each'
/usr/local/lib/ruby/gems/2.0.0/gems/rake-10.0.3/lib/rake/application.rb:101:in `block in top_level'
/usr/local/lib/ruby/gems/2.0.0/gems/rake-10.0.3/lib/rake/application.rb:110:in `run_with_threads'
/usr/local/lib/ruby/gems/2.0.0/gems/rake-10.0.3/lib/rake/application.rb:95:in `top_level'
/usr/local/lib/ruby/gems/2.0.0/gems/rake-10.0.3/lib/rake/application.rb:73:in `block in run'
/usr/local/lib/ruby/gems/2.0.0/gems/rake-10.0.3/lib/rake/application.rb:160:in `standard_exception_handling'
/usr/local/lib/ruby/gems/2.0.0/gems/rake-10.0.3/lib/rake/application.rb:70:in `run'
/usr/local/lib/ruby/gems/2.0.0/gems/rake-10.0.3/bin/rake:33:in `<top (required)>'
/usr/local/bin/rake:23:in `load'
/usr/local/bin/rake:23:in `<main>'
Tasks: TOP => db:create => environment
Gemfile:
source 'http://rubygems.org'
gem 'rails', '3.2.12'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem "less-rails", "~> 2.2.6"
gem 'coffee-rails', '~> 3.2.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
gem 'therubyracer', :platforms => :ruby
gem "sass-rails", "~> 3.2.6"
gem "twitter-bootstrap-rails", '2.1.4'
gem 'bootstrap-sass', '~> 2.3.0.1'
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
# To use Jbuilder templates for JSON
# gem 'jbuilder'
# Use unicorn as the app server
gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger
# gem 'debugger'
gem "mongoid", "~> 3.0.0"
I'm on Ubuntu 10.04.4 LTS, with rails 3.2.12, ruby 2.0.0p0 (2013-02-24 revision 39474) [i686-linux]
Just tested this on my local env. OSX 10.8.x and the same error appears.
What am I missing?
I just found this on the Mongoid home page:
db:create: Exists only for dependency purposes, does not actually do anything.
Therefore, when rake attempts to access your database (why it does this, I do not know), it throws an error because it doesn't exist.
Instead, mongoid provides this:
db:seed: Seeds the database from db/seeds.rb
db:setup: Creates indexes and seeds the database.
Therefore, your basic db setup should be defined in db/seeds.rb, and you can load it with
rake db:setup
Related
I have a blog that uploads banner and thumbnail images. I originally had it set to upload to the local directory using the carrierwave gem and I wanted to try to use digitalocean spaces since the app is deployed to the digitalocean app platform. I am able to get it working on localhost:3000 but when I deploy it to digitalocean it keeps reverting back to a previous deployment saying that a health check failed but not real errors.
I decided to deploy it to heroku since I am able to get actual errors. Here is the current error I get from heroku:
2021-03-09T22:41:10.466080+00:00 heroku[web.1]: Starting process with command `bin/rails server -p ${PORT:-5000} -e production`
2021-03-09T22:41:20.121636+00:00 app[web.1]: => Booting Puma
2021-03-09T22:41:20.121679+00:00 app[web.1]: => Rails 6.1.3 application starting in production
2021-03-09T22:41:20.121679+00:00 app[web.1]: => Run `bin/rails server --help` for more startup options
2021-03-09T22:41:31.105804+00:00 app[web.1]: [fog][WARNING] Unable to fetch credentials: Connection refused - connect(2) for 169.254.169.254:80 (Errno::ECONNREFUSED)
2021-03-09T22:41:31.108732+00:00 app[web.1]: Exiting
2021-03-09T22:41:31.110380+00:00 app[web.1]: /app/vendor/bundle/ruby/3.0.0/gems/fog-core-2.2.3/lib/fog/core/service.rb:244:in `validate_options': Missing required arguments: aws_access_key_id, aws_secret_access_key (ArgumentError)
2021-03-09T22:41:31.110386+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/fog-core-2.2.3/lib/fog/core/service.rb:268:in `handle_settings'
2021-03-09T22:41:31.110391+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/fog-core-2.2.3/lib/fog/core/service.rb:98:in `new'
2021-03-09T22:41:31.110426+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/fog-core-2.2.3/lib/fog/core/services_mixin.rb:30:in `new'
2021-03-09T22:41:31.110427+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/carrierwave-2.2.0/lib/carrierwave/storage/fog.rb:68:in `eager_load'
2021-03-09T22:41:31.110431+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/carrierwave-2.2.0/lib/carrierwave.rb:77:in `block in <class:Railtie>'
2021-03-09T22:41:31.110435+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.3/lib/active_support/lazy_load_hooks.rb:68:in `block in execute_hook'
2021-03-09T22:41:31.110467+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.3/lib/active_support/lazy_load_hooks.rb:61:in `with_execution_control'
2021-03-09T22:41:31.110472+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.3/lib/active_support/lazy_load_hooks.rb:66:in `execute_hook'
2021-03-09T22:41:31.110473+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.3/lib/active_support/lazy_load_hooks.rb:52:in `block in run_load_hooks'
2021-03-09T22:41:31.110508+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.3/lib/active_support/lazy_load_hooks.rb:51:in `each'
2021-03-09T22:41:31.111096+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.3/lib/active_support/lazy_load_hooks.rb:51:in `run_load_hooks'
2021-03-09T22:41:31.111100+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/railties-6.1.3/lib/rails/application/finisher.rb:129:in `block in <module:Finisher>'
2021-03-09T22:41:31.111101+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/railties-6.1.3/lib/rails/initializable.rb:32:in `instance_exec'
2021-03-09T22:41:31.111127+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/railties-6.1.3/lib/rails/initializable.rb:32:in `run'
2021-03-09T22:41:31.111132+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/railties-6.1.3/lib/rails/initializable.rb:61:in `block in run_initializers'
2021-03-09T22:41:31.111132+00:00 app[web.1]: from /app/vendor/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:228:in `block in tsort_each'
2021-03-09T22:41:31.111164+00:00 app[web.1]: from /app/vendor/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
2021-03-09T22:41:31.111168+00:00 app[web.1]: from /app/vendor/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:431:in `each_strongly_connected_component_from'
2021-03-09T22:41:31.111169+00:00 app[web.1]: from /app/vendor/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:349:in `block in each_strongly_connected_component'
2021-03-09T22:41:31.111201+00:00 app[web.1]: from /app/vendor/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:347:in `each'
2021-03-09T22:41:31.111202+00:00 app[web.1]: from /app/vendor/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:347:in `call'
2021-03-09T22:41:31.111772+00:00 app[web.1]: from /app/vendor/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:347:in `each_strongly_connected_component'
2021-03-09T22:41:31.111777+00:00 app[web.1]: from /app/vendor/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:226:in `tsort_each'
2021-03-09T22:41:31.111777+00:00 app[web.1]: from /app/vendor/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:205:in `tsort_each'
2021-03-09T22:41:31.111781+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/railties-6.1.3/lib/rails/initializable.rb:60:in `run_initializers'
2021-03-09T22:41:31.111808+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/railties-6.1.3/lib/rails/application.rb:384:in `initialize!'
2021-03-09T22:41:31.111809+00:00 app[web.1]: from /app/config/environment.rb:5:in `<main>'
2021-03-09T22:41:31.111813+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
2021-03-09T22:41:31.111839+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
2021-03-09T22:41:31.111844+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
2021-03-09T22:41:31.111844+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
2021-03-09T22:41:31.111845+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
2021-03-09T22:41:31.111845+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/zeitwerk-2.4.2/lib/zeitwerk/kernel.rb:34:in `require'
2021-03-09T22:41:31.111848+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.3/lib/active_support/dependencies.rb:332:in `block in require'
2021-03-09T22:41:31.111851+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.3/lib/active_support/dependencies.rb:299:in `load_dependency'
2021-03-09T22:41:31.111884+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.3/lib/active_support/dependencies.rb:332:in `require'
2021-03-09T22:41:31.112296+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:53:in `require_relative'
2021-03-09T22:41:31.112301+00:00 app[web.1]: from config.ru:3:in `block in <main>'
2021-03-09T22:41:31.112302+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/rack-2.2.3/lib/rack/builder.rb:116:in `eval'
2021-03-09T22:41:31.112334+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/rack-2.2.3/lib/rack/builder.rb:116:in `new_from_string'
2021-03-09T22:41:31.112339+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/rack-2.2.3/lib/rack/builder.rb:105:in `load_file'
2021-03-09T22:41:31.112340+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/rack-2.2.3/lib/rack/builder.rb:66:in `parse_file'
2021-03-09T22:41:31.112367+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/rack-2.2.3/lib/rack/server.rb:349:in `build_app_and_options_from_config'
2021-03-09T22:41:31.112368+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/rack-2.2.3/lib/rack/server.rb:249:in `app'
2021-03-09T22:41:31.112372+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/rack-2.2.3/lib/rack/server.rb:422:in `wrapped_app'
2021-03-09T22:41:31.112398+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/rack-2.2.3/lib/rack/server.rb:312:in `block in start'
2021-03-09T22:41:31.112403+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/rack-2.2.3/lib/rack/server.rb:379:in `handle_profiling'
2021-03-09T22:41:31.112809+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/rack-2.2.3/lib/rack/server.rb:311:in `start'
2021-03-09T22:41:31.112813+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/railties-6.1.3/lib/rails/commands/server/server_command.rb:39:in `start'
2021-03-09T22:41:31.112841+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/railties-6.1.3/lib/rails/commands/server/server_command.rb:144:in `block in perform'
2021-03-09T22:41:31.112845+00:00 app[web.1]: from <internal:kernel>:90:in `tap'
2021-03-09T22:41:31.112846+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/railties-6.1.3/lib/rails/commands/server/server_command.rb:135:in `perform'
2021-03-09T22:41:31.112877+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/thor-1.1.0/lib/thor/command.rb:27:in `run'
2021-03-09T22:41:31.112881+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/thor-1.1.0/lib/thor/invocation.rb:127:in `invoke_command'
2021-03-09T22:41:31.112882+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/thor-1.1.0/lib/thor.rb:392:in `dispatch'
2021-03-09T22:41:31.112912+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/railties-6.1.3/lib/rails/command/base.rb:69:in `perform'
2021-03-09T22:41:31.114191+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/railties-6.1.3/lib/rails/command.rb:50:in `invoke'
2021-03-09T22:41:31.114195+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/railties-6.1.3/lib/rails/commands.rb:18:in `<main>'
2021-03-09T22:41:31.114196+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
2021-03-09T22:41:31.114229+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
2021-03-09T22:41:31.114234+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
2021-03-09T22:41:31.114234+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
2021-03-09T22:41:31.114261+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
2021-03-09T22:41:31.114262+00:00 app[web.1]: from bin/rails:5:in `<main>'
2021-03-09T22:41:31.238223+00:00 heroku[web.1]: Process exited with status 1
2021-03-09T22:41:31.311694+00:00 heroku[web.1]: State changed from starting to crashed
After the server starts it crashes saying fog cannot get the credentials.
Here is my initializer/carrierwave.rb file:
CarrierWave.configure do |config|
config.fog_credentials = {
provider: 'AWS', # required
aws_access_key_id: Rails.application.credentials.aws(:digitalocean_spaces_key), # required unless using use_iam_profile
aws_secret_access_key: Rails.application.credentials.aws(:digitalocean_spaces_secret), # required unless using use_iam_profile
use_iam_profile: true, # optional, defaults to false
region: 'nyc3', # optional, defaults to 'us-east-1'
host: 'nyc3.digitaloceanspaces.com', # optional, defaults to nil
endpoint: 'https://nyc3.digitaloceanspaces.com' # optional, defaults to nil
}
config.fog_directory = 'judo' # required
config.fog_public = true # optional, defaults to true
#config.fog_attributes = { cache_control: "public, max-age=#{365.days.to_i}" } # optional, defaults to {}
# For an application which utilizes multiple servers but does not need caches persisted across requests,
# uncomment the line :file instead of the default :storage. Otherwise, it will use AWS as the temp cache store.
# config.cache_storage = :file
end
Here is another attempt at the carrierwave.rb file:
CarrierWave.configure do |config|
config.fog_credentials = {
provider: 'AWS', # required
digitalocean_spaces_key_id: Rails.application.credentials.digitalocean_spaces_key, # required unless using use_iam_profile
digitalocean_spaces_secret: Rails.application.credentials.digitalocean_spaces_secret,
digitalocean_spaces_bucket: Rails.application.credentials.digitalocean_spaces_bucket,
use_iam_profile: true, # optional, defaults to false
region: 'nyc3', # optional, defaults to 'us-east-1'
host: 'nyc3.digitaloceanspaces.com', # optional, defaults to nil
endpoint: 'https://nyc3.digitaloceanspaces.com' # optional, defaults to nil
}
config.fog_directory = 'judo' # required
config.fog_public = true # optional, defaults to true
#config.fog_attributes = { cache_control: "public, max-age=#{365.days.to_i}" } # optional, defaults to {}
# For an application which utilizes multiple servers but does not need caches persisted across requests,
# uncomment the line :file instead of the default :storage. Otherwise, it will use AWS as the temp cache store.
# config.cache_storage = :file
end
Here is my credentials.yml file:
production:
digitalocean_spaces_key: <%= ENV["DIGITALOCEAN_SPACES_KEY"] %>
digitalocean_spaces_secret: <%= ENV["DIGITALOCEAN_SPACES_SECRET"] %>
digitalocean_spaces_bucket: <%= ENV["DIGITALOCEAN_SPACES_BUCKET"] %>
development:
digitalocean_spaces_key: my_key
digitalocean_spaces_secret: my_secret
digitalocean_spaces_bucket: judo
I entered the spaces key, secret, and bucket as app level variables in the app on digitalocean.
Here is my uploaders/banner_uploader.rb file:
class BannerUploader < CarrierWave::Uploader::Base
# Include RMagick or MiniMagick support:
# include CarrierWave::RMagick
#include CarrierWave::MiniMagick
# Choose what kind of storage to use for this uploader:
# storage :file
storage :fog
# Override the directory where uploaded files will be stored.
# This is a sensible default for uploaders that are meant to be mounted:
def store_dir
"uploads/#{model.class.to_s.underscore}/#{mounted_as}"
end
# Provide a default URL as a default if there hasn't been a file uploaded:
# def default_url(*args)
# # For Rails 3.1+ asset pipeline compatibility:
# # ActionController::Base.helpers.asset_path("fallback/" + [version_name, "default.png"].compact.join('_'))
#
# "/images/fallback/" + [version_name, "default.png"].compact.join('_')
# end
# Process files as they are uploaded:
# process scale: [200, 300]
#
# def scale(width, height)
# # do something
# end
# Create different versions of your uploaded files:
# version :thumb do
# process resize_to_fit: [50, 50]
# end
# Add an allowlist of extensions which are allowed to be uploaded.
# For images you might use something like this:
def extension_allowlist
%w(jpg jpeg gif png)
end
# Override the filename of the uploaded files:
# Avoid using model.id or version_name here, see uploader/store.rb for details.
# def filename
# "something.jpg" if original_filename
# end
end
Here is my post.rb:
class Post < ApplicationRecord
belongs_to :user
has_many :comments, as: :commentable, dependent: :destroy
# Active Storage from Rails 5
#has_one_attached :thumbnail
#has_one_attached :banner
# Action Text from Rails 6
has_rich_text :body
mount_uploader :banner, BannerUploader
validates :title, length: { minimum: 5 }
validates :body, length: { minimum: 25 }
self.per_page = 10
extend FriendlyId
friendly_id :title, use: :slugged
end
And here is my Gemfile:
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby '3.0.0'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails', branch: 'main'
gem 'rails', '~> 6.1.3'
# Use Puma as the app server
gem 'puma', '~> 5.0'
# Use SCSS for stylesheets
gem 'sass-rails', '>= 6'
# Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker
gem 'webpacker', '~> 5.0'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.7'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 4.0'
# Use Active Model has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use Active Storage variant
gem 'image_processing', '~> 1.2'
# Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap', '>= 1.4.4', require: false
group :development, :test do
# Use sqlite3 as the database for Active Record
gem 'sqlite3', '~> 1.4'
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
end
group :development do
# Access an interactive console on exception pages or by calling 'console' anywhere in the code.
gem 'web-console', '>= 4.1.0'
# Display performance information such as SQL time and flame graphs for each request in your browser.
# Can be configured to work on production as well see: https://github.com/MiniProfiler/rack-mini-profiler/blob/master/README.md
# gem 'rack-mini-profiler', '~> 2.0'
gem 'listen', '~> 3.3'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
end
group :production do
gem 'pg'
end
group :test do
# Adds support for Capybara system testing and selenium driver
gem 'capybara', '>= 3.26'
gem 'selenium-webdriver'
# Easy installation and use of web drivers to run system tests with browsers
gem 'webdrivers'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
gem 'devise'
gem 'simple_form'
gem 'faker'
gem 'will_paginate'
gem 'friendly_id'
gem "carrierwave"
gem "mime-types"
gem "fog-aws"
It seems like the server can't access to the content of the credentials.yml. This file is encrypted and Rails use the master key store in the master.key file to read it. So given that the master.key is not checked into version control, you need to provide it manually on the server. Please check this article https://medium.com/cedarcode/rails-5-2-credentials-9b3324851336
This section :
Deploying master key
When you move your code to a server, you need to make sure that your config/credentials.yml.enc file can be decrypted. That means that somehow you’ll need to provide Rails with your master key, given that it is not checked into version control.
There are two ways of doing that:
Option 1: Place the config/master.key file in the server. You’ll normally want to symlink this file to a shared folder in the server filesystem. Again, do not version your config/master.key file.
Option 2: create a RAILS_MASTER_KEY ENV variable. Rails will detect it and use it as your master key, e.g. in heroku: heroku config:set RAILS_MASTER_KEY=.
You should be able to use any of those indistinctly.
If you are using RBENV as you ruby manager, you can store your env var doing this :
You will create .rbenv-vars in your project folder, not your rails project folder but the folder in which is your project folder, the parent folder if you want.
After that you put your env var inside the file like this:
DATABASE_PWD=*****
no quotes, no space too before ou after the "="
For more check this link on goRails : https://gorails.com/deploy/ubuntu/18.04#capistrano
Hope this can help
I had a running app with no problem and just did bundle update and bundle install and now.
I had not bundle updated for the past 4 months I think.
Now when I run $ rails s, I have this error:
".../gems/sprockets-2.12.3/lib/sprockets/manifest.rb:65:in `read': Is a directory - .../public/assets (Errno::EISDIR)"!
mathieu-To-be-filled-by-O-E-M:~/rails_projects/mathieu_app$ rails s
DEPRECATION WARNING: Support for Rails < 4.1.0 will be dropped. (called from require at /home/mathieu/.rvm/gems/ruby-2.0.0-p451#global/gems/bundler-1.5.3/lib/bundler/runtime.rb:76)
=> Booting WEBrick
=> Rails 4.0.12 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
DEPRECATION WARNING: Model based mass assignment security has been extracted
out of Rails into a gem. Please use the new recommended protection model for
params or add `protected_attributes` to your Gemfile to use the old one.
To disable this message remove the `whitelist_attributes` option from your
`config/application.rb` file and any `mass_assignment_sanitizer` options
from your `config/environments/*.rb` files.
See http://guides.rubyonrails.org/security.html#mass-assignment for more information.
Exiting
/home/mathieu/.rvm/gems/ruby-2.0.0-p451#rails3tutorial2ndEd/gems/sprockets-2.12.3/lib/sprockets/manifest.rb:65:in `read': Is a directory - /home/mathieu/rails_projects/mathieu_app/public/assets (Errno::EISDIR)
from /home/mathieu/.rvm/gems/ruby-2.0.0-p451#rails3tutorial2ndEd/gems/sprockets-2.12.3/lib/sprockets/manifest.rb:65:in `initialize'
from /home/mathieu/.rvm/gems/ruby-2.0.0-p451#rails3tutorial2ndEd/gems/sprockets-rails-2.2.2/lib/sprockets/railtie.rb:105:in `new'
from /home/mathieu/.rvm/gems/ruby-2.0.0-p451#rails3tutorial2ndEd/gems/sprockets-rails-2.2.2/lib/sprockets/railtie.rb:105:in `block in <class:Railtie>'
from /home/mathieu/.rvm/gems/ruby-2.0.0-p451#rails3tutorial2ndEd/gems/activesupport-4.0.12/lib/active_support/lazy_load_hooks.rb:36:in `call'
from /home/mathieu/.rvm/gems/ruby-2.0.0-p451#rails3tutorial2ndEd/gems/activesupport-4.0.12/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
from /home/mathieu/.rvm/gems/ruby-2.0.0-p451#rails3tutorial2ndEd/gems/activesupport-4.0.12/lib/active_support/lazy_load_hooks.rb:45:in `block in run_load_hooks'
from /home/mathieu/.rvm/gems/ruby-2.0.0-p451#rails3tutorial2ndEd/gems/activesupport-4.0.12/lib/active_support/lazy_load_hooks.rb:44:in `each'
from /home/mathieu/.rvm/gems/ruby-2.0.0-p451#rails3tutorial2ndEd/gems/activesupport-4.0.12/lib/active_support/lazy_load_hooks.rb:44:in `run_load_hooks'
from /home/mathieu/.rvm/gems/ruby-2.0.0-p451#rails3tutorial2ndEd/gems/railties-4.0.12/lib/rails/application/finisher.rb:62:in `block in <module:Finisher>'
from /home/mathieu/.rvm/gems/ruby-2.0.0-p451#rails3tutorial2ndEd/gems/railties-4.0.12/lib/rails/initializable.rb:30:in `instance_exec'
from /home/mathieu/.rvm/gems/ruby-2.0.0-p451#rails3tutorial2ndEd/gems/railties-4.0.12/lib/rails/initializable.rb:30:in `run'
from /home/mathieu/.rvm/gems/ruby-2.0.0-p451#rails3tutorial2ndEd/gems/railties-4.0.12/lib/rails/initializable.rb:55:in `block in run_initializers'
from /home/mathieu/.rvm/rubies/ruby-2.0.0-p451/lib/ruby/2.0.0/tsort.rb:150:in `block in tsort_each'
from /home/mathieu/.rvm/rubies/ruby-2.0.0-p451/lib/ruby/2.0.0/tsort.rb:183:in `block (2 levels) in each_strongly_connected_component'
from /home/mathieu/.rvm/rubies/ruby-2.0.0-p451/lib/ruby/2.0.0/tsort.rb:219:in `each_strongly_connected_component_from'
from /home/mathieu/.rvm/rubies/ruby-2.0.0-p451/lib/ruby/2.0.0/tsort.rb:182:in `block in each_strongly_connected_component'
from /home/mathieu/.rvm/rubies/ruby-2.0.0-p451/lib/ruby/2.0.0/tsort.rb:180:in `each'
from /home/mathieu/.rvm/rubies/ruby-2.0.0-p451/lib/ruby/2.0.0/tsort.rb:180:in `each_strongly_connected_component'
from /home/mathieu/.rvm/rubies/ruby-2.0.0-p451/lib/ruby/2.0.0/tsort.rb:148:in `tsort_each'
from /home/mathieu/.rvm/gems/ruby-2.0.0-p451#rails3tutorial2ndEd/gems/railties-4.0.12/lib/rails/initializable.rb:54:in `run_initializers'
from /home/mathieu/.rvm/gems/ruby-2.0.0-p451#rails3tutorial2ndEd/gems/railties-4.0.12/lib/rails/application.rb:215:in `initialize!'
from /home/mathieu/.rvm/gems/ruby-2.0.0-p451#rails3tutorial2ndEd/gems/railties-4.0.12/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /home/mathieu/rails_projects/mathieu_app/config/environment.rb:5:in `<top (required)>'
from /home/mathieu/.rvm/gems/ruby-2.0.0-p451#rails3tutorial2ndEd/gems/activesupport-4.0.12/lib/active_support/dependencies.rb:229:in `require'
from /home/mathieu/.rvm/gems/ruby-2.0.0-p451#rails3tutorial2ndEd/gems/activesupport-4.0.12/lib/active_support/dependencies.rb:229:in `block in require'
from /home/mathieu/.rvm/gems/ruby-2.0.0-p451#rails3tutorial2ndEd/gems/activesupport-4.0.12/lib/active_support/dependencies.rb:214:in `load_dependency'
from /home/mathieu/.rvm/gems/ruby-2.0.0-p451#rails3tutorial2ndEd/gems/activesupport-4.0.12/lib/active_support/dependencies.rb:229:in `require'
from /home/mathieu/rails_projects/mathieu_app/config.ru:3:in `block in <main>'
from /home/mathieu/.rvm/gems/ruby-2.0.0-p451#global/gems/rack-1.5.2/lib/rack/builder.rb:55:in `instance_eval'
from /home/mathieu/.rvm/gems/ruby-2.0.0-p451#global/gems/rack-1.5.2/lib/rack/builder.rb:55:in `initialize'
from /home/mathieu/rails_projects/mathieu_app/config.ru:in `new'
from /home/mathieu/rails_projects/mathieu_app/config.ru:in `<main>'
from /home/mathieu/.rvm/gems/ruby-2.0.0-p451#global/gems/rack-1.5.2/lib/rack/builder.rb:49:in `eval'
from /home/mathieu/.rvm/gems/ruby-2.0.0-p451#global/gems/rack-1.5.2/lib/rack/builder.rb:49:in `new_from_string'
from /home/mathieu/.rvm/gems/ruby-2.0.0-p451#global/gems/rack-1.5.2/lib/rack/builder.rb:40:in `parse_file'
from /home/mathieu/.rvm/gems/ruby-2.0.0-p451#global/gems/rack-1.5.2/lib/rack/server.rb:277:in `build_app_and_options_from_config'
from /home/mathieu/.rvm/gems/ruby-2.0.0-p451#global/gems/rack-1.5.2/lib/rack/server.rb:199:in `app'
from /home/mathieu/.rvm/gems/ruby-2.0.0-p451#rails3tutorial2ndEd/gems/railties-4.0.12/lib/rails/commands/server.rb:48:in `app'
from /home/mathieu/.rvm/gems/ruby-2.0.0-p451#global/gems/rack-1.5.2/lib/rack/server.rb:314:in `wrapped_app'
from /home/mathieu/.rvm/gems/ruby-2.0.0-p451#rails3tutorial2ndEd/gems/railties-4.0.12/lib/rails/commands/server.rb:75:in `start'
from /home/mathieu/.rvm/gems/ruby-2.0.0-p451#rails3tutorial2ndEd/gems/railties-4.0.12/lib/rails/commands.rb:76:in `block in <top (required)>'
from /home/mathieu/.rvm/gems/ruby-2.0.0-p451#rails3tutorial2ndEd/gems/railties-4.0.12/lib/rails/commands.rb:71:in `tap'
from /home/mathieu/.rvm/gems/ruby-2.0.0-p451#rails3tutorial2ndEd/gems/railties-4.0.12/lib/rails/commands.rb:71:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
My gem list:
source 'https://rubygems.org'
ruby "2.0.0" # source: https://devcenter.heroku.com/articles/ruby-versions
# Rails 4
gem 'rails', "~> 4.0.3"
# Gems supporting Rails 4 core architecture
gem 'actionpack-action_caching'
gem 'actionpack-page_caching'
gem 'activerecord-session_store'
gem 'activeresource'
gem 'rails-observers'
gem 'turbolinks'
gem 'pg'
gem 'anjlab-bootstrap-rails', :require => 'bootstrap-rails',
:github => 'anjlab/bootstrap-rails',
:branch => '3.0.0'
gem 'devise' # authentification
gem 'cancan' # authorization
gem 'rolify', :git => 'git://github.com/EppO/rolify.git' # role management library with resource scoping, added fork due to bug source - stackoverflow.com/questions/13712012/error-pushing-to-heroku-aborting-my-rake-assetsprecompile?rq=1
gem 'figaro' # rails app configuration and keep private stuff...private
gem 'sendgrid' # sendgrid gem
gem 'faker' # to create fake user accounts
gem 'will_paginate' # pagination method
gem 'bootstrap-will_paginate' # configure will_paginate gem to bootstrap pagination style
gem 'font-awesome-rails' # pure css icons
gem 'validates_timeliness' # methods and validations for dates formats
gem 'validate_url' # for URL validations in forms
gem 'dotiw' # overrides the default distance_of_time_in_words and provides a more accurate output
gem 'friendly_id'
# Forms with formtastic
gem 'formtastic'
gem 'formtastic-bootstrap'
# Active admin stuff
gem 'activeadmin', github: 'gregbell/active_admin' # added github because of deployment issue wiht jquery ui http://stackoverflow.com/questions/16844411/rails-active-admin-deployment-couldnt-find-file-jquery-ui
gem 'sass-rails', '~> 4.0.1' # Master branch not OK with Rails 4, hence we point to branch that comply with Rails 4
gem 'kaminari' #'0.14.1' active admin needs kaminari for pagination; blocked on 0.14.1 because if not get nomethod error per_page kaminari https://github.com/sferik/rails_admin/issues/1868 and https://github.com/amatsuda/kaminari/issues/481
gem 'postgres_ext' # gives a nice set of query methods & Adds missing native PostgreSQL data types to ActiveRecord and convenient querying extensions for ActiveRecord and Arel for Rails 4.x
gem 'jquery-rails'
gem 'chosen-rails'
gem 'coffee-rails', '~> 4.0.1' # Master branch not OK with Rails 4, hence we point to branch that comply with Rails 4 by default
gem 'uglifier'
# Geocoding and locations
gem 'geocoder'
gem 'country-select'
group :production do
gem 'rails_12factor'
end
group :development do
gem 'quiet_assets' # mutes assets pipeline log messages
gem 'better_errors' # improve error pages
# retrieve binding of a method's caller in MRI 1.9.2+, only for debugging
gem 'binding_of_caller', platforms: [:mri_19, :rbx]
end
group :development, :test do
gem 'perftools.rb', require: 'perftools' # used to find tasks taking long time (ex when test are too long)
gem 'guard', '>=2.1.0'
gem 'guard-rspec'
gem 'guard-rails-assets'
gem 'rspec-rails'
gem 'factory_girl_rails'
gem 'pry-rails'
gem 'rspec-collection_matchers'
gem 'i18n-tasks'
end
group :test do
gem 'capybara'
gem 'selenium-webdriver' -ex: flash error messages...
gem 'capybara-webkit' -ex: flash error messages...
gem 'rb-inotify'
gem 'libnotify'
gem 'database_cleaner'
gem 'email_spec'
gem 'cucumber-rails', :require => false #
gem 'launchy'
gem 'shoulda-matchers'
gem 'minitest'
gem 'guard-zeus-client'
If you look in the source code of the sprockets gem (where the error is coming from) you can see that the error is being raised by these lines:
63 begin
64 if File.exist?(#path)
65 data = json_decode(File.read(#path))
66 end
67 rescue MultiJson::DecodeError => e
68 logger.error "#{#path} is invalid: #{e.class} #{e.message}"
69 end
Line 65 is the problem, specifically File.read(#path) - as shown by your error message (sprockets-2.12.3/lib/sprockets/manifest.rb:65:in `read').
Basically, #path is supposed to be a string representing a filename but it's actually pointing to a directory, which is causing File.read to fail. #path is supposed to be pointing to your asset's manifest file (usually created automatically by Sprockets) and I'm not sure why it's getting the incorrect path here - do you have anything that looks relevant to your manifest file in config/application.rb or in your environment config files? What about in app/assets/javascripts/application.js or app/assets/stylesheets/application.css?
Try editing your local copy of sprockets yourself (run "cd `bundle show sprockets`" from your app's directory to find it) and adding puts #path before line 65 above (just make sure you remember to remove it when you're done!) - what does it say?
Hmm... Is it possible that you have Sprocket and structure has been changed, or something like that?
Have you tried to remove that directory ( or just rename it )? This guy removed directory mentioned in error and it worked fine: Trying to install rails- EISDIR error .
There seems to be newer version, have you tried to update? (https://rubygems.org/gems/sprockets-rails)
NOTE: This should be comment but I don't have enough reputation for that...
Removing or commenting out this line of code in development.rb solves the problem:
config.assets.manifest = Rails.root.join("public/assets")
I have my app running successfully on my local machine.
But when I tried to push it to heroku and get it running live on internet, it fails with this error message.
git push heroku mybranch:master
....
undefined method `admin_notes=' for #<ActiveAdmin::Application:0x007fb896f03678>
/tmp/build_fad3ae53-5d67-4131-93b9-c46de602ed36/config/initializers/active_admin.rb:55:in `block in <top (required)>'
/tmp/build_fad3ae53-5d67-4131-93b9-c46de602ed36/vendor/bundle/ruby/2.0.0/gems/activeadmin-0.6.2/lib/active_admin.rb:66:in `setup'
/tmp/build_fad3ae53-5d67-4131-93b9-c46de602ed36/config/initializers/active_admin.rb:1:in `<top (required)>'
/tmp/build_fad3ae53-5d67-4131-93b9-c46de602ed36/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.14/lib/active_support/dependencies.rb:245:in `load'
/tmp/build_fad3ae53-5d67-4131-93b9-c46de602ed36/vendor/bundle/ruby/2.0.0/gems/activesupport-.2.14/lib/active_support/dependencies.rb:245:in `block in load'
/tmp/build_fad3ae53-5d67-4131-93b9-c46de602ed36/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.14/lib/active_support/dependencies.rb:236:in `load_dependency'
/tmp/build_fad3ae53-5d67-4131-93b9-c46de602ed36/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.14/lib/active_support/dependencies.rb:245:in `load'
/tmp/build_fad3ae53-5d67-4131-93b9-c46de602ed36/vendor/bundle/ruby/2.0.0/gems/railties-3.2.14/lib/rails/engine.rb:593:in `block (2 levels) in <class:Engine>'
/tmp/build_fad3ae53-5d67-4131-93b9-c46de602ed36/vendor/bundle/ruby/2.0.0/gems/railties-3.2.14/lib/rails/engine.rb:592:in `each'
/tmp/build_fad3ae53-5d67-4131-93b9-c46de602ed36/vendor/bundle/ruby/2.0.0/gems/railties-3.2.14/lib/rails/engine.rb:592:in `block in <class:Engine>'
/tmp/build_fad3ae53-5d67-4131-93b9-c46de602ed36/vendor/bundle/ruby/2.0.0/gems/railties-3.2.14/lib/rails/initializable.rb:30:in `instance_exec'
/tmp/build_fad3ae53-5d67-4131-93b9-c46de602ed36/vendor/bundle/ruby/2.0.0/gems/railties-3.2.14/lib/rails/initializable.rb:30:in `run'
/tmp/build_fad3ae53-5d67-4131-93b9-c46de602ed36/vendor/bundle/ruby/2.0.0/gems/railties-3.2.14/lib/rails/initializable.rb:55:in `block in run_initializers'
/tmp/build_fad3ae53-5d67-4131-93b9-c46de602ed36/vendor/bundle/ruby/2.0.0/gems/railties-3.2.14/lib/rails/initializable.rb:54:in `each'
/tmp/build_fad3ae53-5d67-4131-93b9-c46de602ed36/vendor/bundle/ruby/2.0.0/gems/railties-3.2.14/lib/rails/initializable.rb:54:in `run_initializers'
/tmp/build_fad3ae53-5d67-4131-93b9-c46de602ed36/vendor/bundle/ruby/2.0.0/gems/railties-3.2.14/lib/rails/application.rb:136:in `initialize!'
/tmp/build_fad3ae53-5d67-4131-93b9-c46de602ed36/vendor/bundle/ruby/2.0.0/gems/railties-3.2.14/lib/rails/railtie/configurable.rb:30:in `method_missing'
/tmp/build_fad3ae53-5d67-4131-93b9-c46de602ed36/config/environment.rb:5:in `<top (required)>'
/tmp/build_fad3ae53-5d67-4131-93b9-c46de602ed36/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.14/lib/active_support/dependencies.rb:251:in `require'
/tmp/build_fad3ae53-5d67-4131-93b9-c46de602ed36/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.14/lib/active_support/dependencies.rb:251:in `block in require'
/tmp/build_fad3ae53-5d67-4131-93b9-c46de602ed36/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.14/lib/active_support/dependencies.rb:236:in `load_dependency'
/tmp/build_fad3ae53-5d67-4131-93b9-c46de602ed36/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.14/lib/active_support/dependencies.rb:251:in `require'
/tmp/build_fad3ae53-5d67-4131-93b9-c46de602ed36/vendor/bundle/ruby/2.0.0/gems/railties-3.2.14/lib/rails/application.rb:103:in `require_environment!'
/tmp/build_fad3ae53-5d67-4131-93b9-c46de602ed36/vendor/bundle/ruby/2.0.0/gems/railties-3.2.14/lib/rails/application.rb:305:in `block (2 levels) in initialize_tasks'
/tmp/build_fad3ae53-5d67-4131-93b9-c46de602ed36/vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.14/lib/sprockets/assets.rake:93:in `block (2 levels) in <top (required)>'
/tmp/build_fad3ae53-5d67-4131-93b9-c46de602ed36/vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.14/lib/sprockets/assets.rake:60:in `block (3 levels) in <top (required)>'
/tmp/build_fad3ae53-5d67-4131-93b9-c46de602ed36/vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.14/lib/sprockets/assets.rake:23:in `invoke_or_reboot_rake_task'
/tmp/build_fad3ae53-5d67-4131-93b9-c46de602ed36/vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.14/lib/sprockets/assets.rake:29:in `block (2 levels) in <top (required)>'
Tasks: TOP => environment
(See full trace by running task with --trace)
Here is my gem file and active_admin.rb file which I think errors are coming from.
Gemfile
source 'http://rubygems.org'
ruby '2.0.0'
gem 'rails', '3.2.14'
gem 'json'
gem 'thin'
gem 'rails_12factor'
gem 'paymill'
gem 'pg'
gem 'haml'
gem 'jammit', :git => 'https://github.com/documentcloud/jammit.git', :branch => 'master'
gem 'sass-rails'
gem 'uglifier'
gem 'aws-s3'
gem 'aws-sdk'
gem 'friendly_id'
gem 'devise', '~> 2.2.7'
gem 'activeadmin'
gem 'formtastic'
gem 'inherited_resources'
gem 'paperclip', '~> 2.4'
gem 'country_select'
gem 'coffee-script'
group :development, :test do
gem 'escape_utils'
gem 'rails-footnotes'
gem 'rack-webconsole'
gem 'better_errors'
gem 'binding_of_caller'
gem 'pry'
gem 'pry-debugger'
# gem 'taps'
# gem 'steak'
# gem 'spork'
end
group :test do
gem 'factory_girl_rails', '~> 4.1.0'
gem 'rspec-rails', '~> 2.14.0'
gem 'cucumber-rails', '~> 1.4.0', require: false
gem 'database_cleaner', '~> 1.0.1'
# gem 'capybara', '~> 2.1.0'
gem 'simplecov', require: false
end
config/initializers/active_admin.rb
ActiveAdmin.setup do |config|
# == Site Title
#
# Set the title that is displayed on the main layout
# for each of the active admin pages.
#
config.site_title = "IncomeHawk"
# == Default Namespace
#
# Set the default namespace each administration resource
# will be added to.
#
# eg:
# config.default_namespace = :hello_world
#
# This will create resources in the HelloWorld module and
# will namespace routes to /hello_world/*
#
# To set no namespace by default, use:
# config.default_namespace = false
# config.default_namespace = :admin
# == User Authentication
#
# Active Admin will automatically call an authentication
# method in a before filter of all controller actions to
# ensure that there is a currently logged in admin user.
#
# This setting changes the method which Active Admin calls
# within the controller.
config.authentication_method = :http_authenticate
# == Current User
#
# Active Admin will associate actions with the current
# user performing them.
#
# This setting changes the method which Active Admin calls
# to return the currently logged in user.
config.current_user_method = false #:current_user
# == Admin Notes
#
# Admin notes allow you to add notes to any model
#
# Admin notes are enabled by default, but can be disabled
# by uncommenting this line:
#
config.admin_notes = true
# == Controller Filters
#
# You can add before, after and around filters to all of your
# Active Admin resources from here.
#
# config.before_filter :do_something_awesome
# == Register Stylesheets & Javascripts
#
# We recomend using the built in Active Admin layout and loading
# up your own stylesheets / javascripts to customize the look
# and feel.
#
# To load a stylesheet:
# config.register_stylesheet 'my_stylesheet.css'
#
# To load a javascript file:
# config.register_javascript 'my_javascript.js'
end
I tried to follow this railscast to migrate my 3.0.10 rails app to 3.1.10, but things didn't go as smoothly for me as they did for Ryan. After working through some gemset dependency problems I now hit the following error when trying to launch the development server:
[nw0.0.1master (migrate_to_31)]$ rails s
=> Booting WEBrick
=> Rails 3.1.10 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/Users/charlesweinberger/.rvm/gems/ruby-1.9.2-p290#global/gems/rake-0.8.7/lib/rake.rb:2503:in `const_missing': uninitialized constant Sass::Plugin (NameError)
from /Users/charlesweinberger/.rvm/gems/ruby-1.9.2-p290#rails31/gems/aws-s3-0.6.3/lib/aws/s3/extensions.rb:212:in `const_missing_from_s3_library'
from /Users/charlesweinberger/rails_projects/nw0.0.1master/config/initializers/active_admin.rb:2:in `<top (required)>'
from /Users/charlesweinberger/.rvm/gems/ruby-1.9.2-p290#rails31/gems/railties-3.1.10/lib/rails/engine.rb:556:in `block (2 levels) in <class:Engine>'
from /Users/charlesweinberger/.rvm/gems/ruby-1.9.2-p290#rails31/gems/railties-3.1.10/lib/rails/engine.rb:555:in `each'
from /Users/charlesweinberger/.rvm/gems/ruby-1.9.2-p290#rails31/gems/railties-3.1.10/lib/rails/engine.rb:555:in `block in <class:Engine>'
from /Users/charlesweinberger/.rvm/gems/ruby-1.9.2-p290#rails31/gems/railties-3.1.10/lib/rails/initializable.rb:30:in `instance_exec'
from /Users/charlesweinberger/.rvm/gems/ruby-1.9.2-p290#rails31/gems/railties-3.1.10/lib/rails/initializable.rb:30:in `run'
from /Users/charlesweinberger/.rvm/gems/ruby-1.9.2-p290#rails31/gems/railties-3.1.10/lib/rails/initializable.rb:55:in `block in run_initializers'
from /Users/charlesweinberger/.rvm/gems/ruby-1.9.2-p290#rails31/gems/railties-3.1.10/lib/rails/initializable.rb:54:in `each'
from /Users/charlesweinberger/.rvm/gems/ruby-1.9.2-p290#rails31/gems/railties-3.1.10/lib/rails/initializable.rb:54:in `run_initializers'
from /Users/charlesweinberger/.rvm/gems/ruby-1.9.2-p290#rails31/gems/railties-3.1.10/lib/rails/application.rb:96:in `initialize!'
from /Users/charlesweinberger/.rvm/gems/ruby-1.9.2-p290#rails31/gems/railties-3.1.10/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /Users/charlesweinberger/rails_projects/nw0.0.1master/config/environment.rb:7:in `<top (required)>'
from /Users/charlesweinberger/rails_projects/nw0.0.1master/config.ru:3:in `block in <main>'
from /Users/charlesweinberger/.rvm/gems/ruby-1.9.2-p290#rails31/gems/rack-1.3.8/lib/rack/builder.rb:51:in `instance_eval'
from /Users/charlesweinberger/.rvm/gems/ruby-1.9.2-p290#rails31/gems/rack-1.3.8/lib/rack/builder.rb:51:in `initialize'
from /Users/charlesweinberger/rails_projects/nw0.0.1master/config.ru:in `new'
from /Users/charlesweinberger/rails_projects/nw0.0.1master/config.ru:in `<main>'
from /Users/charlesweinberger/.rvm/gems/ruby-1.9.2-p290#rails31/gems/rack-1.3.8/lib/rack/builder.rb:40:in `eval'
from /Users/charlesweinberger/.rvm/gems/ruby-1.9.2-p290#rails31/gems/rack-1.3.8/lib/rack/builder.rb:40:in `parse_file'
from /Users/charlesweinberger/.rvm/gems/ruby-1.9.2-p290#rails31/gems/rack-1.3.8/lib/rack/server.rb:200:in `app'
from /Users/charlesweinberger/.rvm/gems/ruby-1.9.2-p290#rails31/gems/railties-3.1.10/lib/rails/commands/server.rb:46:in `app'
from /Users/charlesweinberger/.rvm/gems/ruby-1.9.2-p290#rails31/gems/rack-1.3.8/lib/rack/server.rb:304:in `wrapped_app'
from /Users/charlesweinberger/.rvm/gems/ruby-1.9.2-p290#rails31/gems/rack-1.3.8/lib/rack/server.rb:254:in `start'
from /Users/charlesweinberger/.rvm/gems/ruby-1.9.2-p290#rails31/gems/railties-3.1.10/lib/rails/commands/server.rb:70:in `start'
from /Users/charlesweinberger/.rvm/gems/ruby-1.9.2-p290#rails31/gems/railties-3.1.10/lib/rails/commands.rb:54:in `block in <top (required)>'
from /Users/charlesweinberger/.rvm/gems/ruby-1.9.2-p290#rails31/gems/railties-3.1.10/lib/rails/commands.rb:49:in `tap'
from /Users/charlesweinberger/.rvm/gems/ruby-1.9.2-p290#rails31/gems/railties-3.1.10/lib/rails/commands.rb:49:in `<top (required)>'
from script/rails:37:in `require'
from script/rails:37:in `<main>'
Here is my current Gemfile:
gem "pg"
gem 'pg_search'
gem 'rails', '3.1.10'
gem 'nokogiri', '1.5.5'
gem 'geocoder', '1.0.2'
gem 'devise', '1.5.3'
gem 'acts_as_api', '0.3.8'
gem 'paperclip', '~>2.4.1'
gem 'rake', '0.8.7'
gem 'omniauth', :git => 'https://github.com/intridea/omniauth.git'
gem 'fb_graph', '1.9.5'
gem 'twitter', :git => 'https://github.com/sferik/twitter.git'
gem 'jquery-rails', '>= 1.0.12'
gem 'aws-s3'
gem 'remotipart', '~> 1.0'
gem 'activeadmin'
gem 'formtastic', '~> 2.1.0'
gem "browser"
gem "httparty"
gem "thin"
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', " ~> 3.1.0"
gem 'coffee-rails', "~> 3.1.0"
gem 'uglifier'
end
group :production, :staging do
end
group :development do
gem 'rspec-rails'
gem 'annotate', '2.4.0'
gem 'faker', '0.3.1'
gem 'ruby-debug19', '0.11.6'
gem 'nifty-generators', '0.4.6'
gem 'silent-postgres'
end
group :test do
gem 'rspec'
gem 'webrat', '0.7.1'
gem 'factory_girl_rails'
gem "mocha", '0.9.12'
gem 'silent-postgres'
end
And, I've enabled the asset pipeline in application.rb. Here is application.rb:
require File.expand_path('../boot', __FILE__)
require 'rails/all'
# 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)
module Nw001
class Application < Rails::Application
# 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'
# 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
# JavaScript files you want as :defaults (application.js is always included).
# config.action_view.javascript_expansions[:defaults] = %w(jquery rails)
# 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]
# 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
# Note, the migration that I use to install the unaccented module for pgs requires SQL
# config.active_record.schema_format = :sql
#uncomment to force ssl on localhost
# config.middleware.insert_before ActionDispatch::Static, "Rack::SSL"
end
end
And, made the suggested additions to my config/environments files.
Any idea how to get passed the uninitialized constant Sass::Plugin (NameError)???
I've also tried to use rails 3.1.0, which throws the same error. I also ran rails generate active_admin:assets to update the active_admin assets, but no love.
UPDATE
On the suggestion of #andrew I created a new sample rails3.1.10 application. Actually, what I did was delete my previous gemset for 3.1; create a new gemset using rvm; installed rails 3.1.10 into the new gemset; started using that new 3.1 gemset; and then created a new rails 3.1.10 app. The app ran as expected.
I then took things one step further by replacing the new apps gemfile with the gemfile from the app that I'm trying to migrate to 3.1.10. After working through a couple of dependency issues and reinserting the sqlite3 gem into the gemfile, again the new test app ran just as expected.
I then copied the test apps' gemfile back into the app that I'm trying to migrate and, still using the new 3.1 gemset, tried to load the development server. I still got an error, and it is similar to the error listed above, but it is somewhat different. Check it out:
[nw0.0.1master (master)]$ rails s
=> Booting WEBrick
=> Rails 3.1.10 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/Users/charlesweinberger/.rvm/gems/ruby-1.9.2-p290#rails31/gems/aws-s3-0.6.3/lib/aws/s3/extensions.rb:212:in `const_missing_from_s3_library': uninitialized constant Sass::Plugin (NameError)
from /Users/charlesweinberger/rails_projects/nw0.0.1master/config/initializers/active_admin.rb:2:in `<top (required)>'
from /Users/charlesweinberger/.rvm/gems/ruby-1.9.2-p290#rails31/gems/railties-3.1.10/lib/rails/engine.rb:556:in `block (2 levels) in <class:Engine>'
from /Users/charlesweinberger/.rvm/gems/ruby-1.9.2-p290#rails31/gems/railties-3.1.10/lib/rails/engine.rb:555:in `each'
from /Users/charlesweinberger/.rvm/gems/ruby-1.9.2-p290#rails31/gems/railties-3.1.10/lib/rails/engine.rb:555:in `block in <class:Engine>'
from /Users/charlesweinberger/.rvm/gems/ruby-1.9.2-p290#rails31/gems/railties-3.1.10/lib/rails/initializable.rb:30:in `instance_exec'
from /Users/charlesweinberger/.rvm/gems/ruby-1.9.2-p290#rails31/gems/railties-3.1.10/lib/rails/initializable.rb:30:in `run'
from /Users/charlesweinberger/.rvm/gems/ruby-1.9.2-p290#rails31/gems/railties-3.1.10/lib/rails/initializable.rb:55:in `block in run_initializers'
from /Users/charlesweinberger/.rvm/gems/ruby-1.9.2-p290#rails31/gems/railties-3.1.10/lib/rails/initializable.rb:54:in `each'
from /Users/charlesweinberger/.rvm/gems/ruby-1.9.2-p290#rails31/gems/railties-3.1.10/lib/rails/initializable.rb:54:in `run_initializers'
from /Users/charlesweinberger/.rvm/gems/ruby-1.9.2-p290#rails31/gems/railties-3.1.10/lib/rails/application.rb:96:in `initialize!'
from /Users/charlesweinberger/.rvm/gems/ruby-1.9.2-p290#rails31/gems/railties-3.1.10/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /Users/charlesweinberger/rails_projects/nw0.0.1master/config/environment.rb:7:in `<top (required)>'
from /Users/charlesweinberger/rails_projects/nw0.0.1master/config.ru:3:in `block in <main>'
from /Users/charlesweinberger/.rvm/gems/ruby-1.9.2-p290#rails31/gems/rack-1.3.8/lib/rack/builder.rb:51:in `instance_eval'
from /Users/charlesweinberger/.rvm/gems/ruby-1.9.2-p290#rails31/gems/rack-1.3.8/lib/rack/builder.rb:51:in `initialize'
from /Users/charlesweinberger/rails_projects/nw0.0.1master/config.ru:in `new'
from /Users/charlesweinberger/rails_projects/nw0.0.1master/config.ru:in `<main>'
from /Users/charlesweinberger/.rvm/gems/ruby-1.9.2-p290#rails31/gems/rack-1.3.8/lib/rack/builder.rb:40:in `eval'
from /Users/charlesweinberger/.rvm/gems/ruby-1.9.2-p290#rails31/gems/rack-1.3.8/lib/rack/builder.rb:40:in `parse_file'
from /Users/charlesweinberger/.rvm/gems/ruby-1.9.2-p290#rails31/gems/rack-1.3.8/lib/rack/server.rb:200:in `app'
from /Users/charlesweinberger/.rvm/gems/ruby-1.9.2-p290#rails31/gems/railties-3.1.10/lib/rails/commands/server.rb:46:in `app'
from /Users/charlesweinberger/.rvm/gems/ruby-1.9.2-p290#rails31/gems/rack-1.3.8/lib/rack/server.rb:304:in `wrapped_app'
from /Users/charlesweinberger/.rvm/gems/ruby-1.9.2-p290#rails31/gems/rack-1.3.8/lib/rack/server.rb:254:in `start'
from /Users/charlesweinberger/.rvm/gems/ruby-1.9.2-p290#rails31/gems/railties-3.1.10/lib/rails/commands/server.rb:70:in `start'
from /Users/charlesweinberger/.rvm/gems/ruby-1.9.2-p290#rails31/gems/railties-3.1.10/lib/rails/commands.rb:54:in `block in <top (required)>'
from /Users/charlesweinberger/.rvm/gems/ruby-1.9.2-p290#rails31/gems/railties-3.1.10/lib/rails/commands.rb:49:in `tap'
from /Users/charlesweinberger/.rvm/gems/ruby-1.9.2-p290#rails31/gems/railties-3.1.10/lib/rails/commands.rb:49:in `<top (required)>'
from script/rails:37:in `require'
from script/rails:37:in `<main>'
Does this new info trigger any ideas???
Thanks!
Problem was caused by me specifying gem 'rake', "0.8.7" in the gemfile. Changed it to gem 'rake', and that solved the problem. Note, you probably don't even need to include rake in the gemfile as it will be included as a dependency.
I just installed Rspec2 in my Rails3 (3.0.3) project. When I run rspec spec from rails root I get:
No examples were matched. Perhaps {:if=>#<Proc:0x00000100933388#/Users/ivan/.rvm/gems/ruby-1.9.2-p180/gems/rspec-core-2.5.1/lib/rspec/core/configuration.rb:50 (lambda)>, :unless=>#<Proc:0x00000100933360#/Users/ivan/.rvm/gems/ruby-1.9.2-p180/gems/rspec-core-2.5.1/lib/rspec/core/configuration.rb:51 (lambda)>} is excluding everything?
Finished in 0.00004 seconds
0 examples, 0 failures
I can run rspec name_of_spec_test.rb directly and that seems to work, but not the generic "rspec spec" command. Also, if I add require 'spec_helper.rb' to the top of my name_of_spec_test.rb file I get:
/Users/ivan/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/net/http.rb:644:in `initialize': Connection refused - connect(2) (Errno::ECONNREFUSED)
from /Users/ivan/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/net/http.rb:644:in `open'
from /Users/ivan/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/net/http.rb:644:in `block in connect'
from /Users/ivan/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/timeout.rb:44:in `timeout'
from /Users/ivan/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/timeout.rb:87:in `timeout'
from /Users/ivan/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/net/http.rb:644:in `connect'
from /Users/ivan/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/net/http.rb:637:in `do_start'
from /Users/ivan/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/net/http.rb:626:in `start'
from /Users/ivan/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/net/http.rb:1168:in `request'
from /Users/ivan/.rvm/gems/ruby-1.9.2-p180/gems/rsolr-1.0.0/lib/rsolr/connection.rb:15:in `execute'
from /Users/ivan/.rvm/gems/ruby-1.9.2-p180/gems/rsolr-1.0.0/lib/rsolr/client.rb:151:in `execute'
from /Users/ivan/.rvm/gems/ruby-1.9.2-p180/gems/rsolr-1.0.0/lib/rsolr/client.rb:146:in `send_and_receive'
from (eval):2:in `post'
from /Users/ivan/.rvm/gems/ruby-1.9.2-p180/gems/rsolr-1.0.0/lib/rsolr/client.rb:55:in `update'
from /Users/ivan/.rvm/gems/ruby-1.9.2-p180/gems/rsolr-1.0.0/lib/rsolr/client.rb:75:in `add'
from /Users/ivan/Documents/Projects/catalog_service.git/app/models/search/cake_to_solr.rb:39:in `<class:Playlist>'
from /Users/ivan/Documents/Projects/catalog_service.git/app/models/search/cake_to_solr.rb:11:in `<top (required)>'
from /Users/ivan/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:239:in `require'
from /Users/ivan/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:239:in `block in require'
from /Users/ivan/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:227:in `load_dependency'
from /Users/ivan/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:239:in `require'
from /Users/ivan/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:346:in `require_or_load'
from /Users/ivan/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:300:in `depend_on'
from /Users/ivan/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:216:in `require_dependency'
from /Users/ivan/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.7/lib/rails/engine.rb:138:in `block (2 levels) in eager_load!'
from /Users/ivan/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.7/lib/rails/engine.rb:137:in `each'
from /Users/ivan/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.7/lib/rails/engine.rb:137:in `block in eager_load!'
from /Users/ivan/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.7/lib/rails/engine.rb:135:in `each'
from /Users/ivan/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.7/lib/rails/engine.rb:135:in `eager_load!'
from /Users/ivan/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.7/lib/rails/application.rb:108:in `eager_load!'
from /Users/ivan/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.7/lib/rails/application/finisher.rb:41:in `block in <module:Finisher>'
from /Users/ivan/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.7/lib/rails/initializable.rb:25:in `instance_exec'
from /Users/ivan/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.7/lib/rails/initializable.rb:25:in `run'
from /Users/ivan/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.7/lib/rails/initializable.rb:50:in `block in run_initializers'
from /Users/ivan/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.7/lib/rails/initializable.rb:49:in `each'
from /Users/ivan/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.7/lib/rails/initializable.rb:49:in `run_initializers'
from /Users/ivan/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.7/lib/rails/application.rb:134:in `initialize!'
from /Users/ivan/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.7/lib/rails/application.rb:77:in `method_missing'
from /Users/ivan/Documents/Projects/catalog_service.git/config/environment.rb:5:in `<top (required)>'
from <internal:lib/rubygems/custom_require>:29:in `require'
from <internal:lib/rubygems/custom_require>:29:in `require'
from /Users/ivan/Documents/Projects/catalog_service.git/spec/spec_helper.rb:3:in `<top (required)>'
from <internal:lib/rubygems/custom_require>:29:in `require'
from <internal:lib/rubygems/custom_require>:29:in `require'
from /Users/ivan/Documents/Projects/catalog_service.git/spec/models/search_test.rb:1:in `<top (required)>'
from /Users/ivan/.rvm/gems/ruby-1.9.2-p180/gems/rspec-core-2.5.1/lib/rspec/core/configuration.rb:386:in `load'
from /Users/ivan/.rvm/gems/ruby-1.9.2-p180/gems/rspec-core-2.5.1/lib/rspec/core/configuration.rb:386:in `block in load_spec_files'
from /Users/ivan/.rvm/gems/ruby-1.9.2-p180/gems/rspec-core-2.5.1/lib/rspec/core/configuration.rb:386:in `map'
from /Users/ivan/.rvm/gems/ruby-1.9.2-p180/gems/rspec-core-2.5.1/lib/rspec/core/configuration.rb:386:in `load_spec_files'
from /Users/ivan/.rvm/gems/ruby-1.9.2-p180/gems/rspec-core-2.5.1/lib/rspec/core/command_line.rb:18:in `run'
from /Users/ivan/.rvm/gems/ruby-1.9.2-p180/gems/rspec-core-2.5.1/lib/rspec/core/runner.rb:55:in `run_in_process'
from /Users/ivan/.rvm/gems/ruby-1.9.2-p180/gems/rspec-core-2.5.1/lib/rspec/core/runner.rb:46:in `run'
from /Users/ivan/.rvm/gems/ruby-1.9.2-p180/gems/rspec-core-2.5.1/lib/rspec/core/runner.rb:10:in `block in autorun'
I am using RVM to manage my rails environment.
I don't know if this is relevant, but when I initially ran script/rails generate rspec:install it only installed .rspec, created the spec dir and spec/spec_helper.rb.
Also, I'm not using rails migrations because we have a variety of databases that we connect to. So, when I create a model, and I test it, I manually create a spec/models directory and put my *_test.rb rspec file in it.
Any ideas about what I'm missing here, would be greatly appreciated!
Here's my Gemfile, spec_helper.rb file, and test.rb files.
Gemfile:
source 'http://rubygems.org'
gem 'rails'
gem 'mysql2', '0.2.6'
gem 'legacy_data'
gem 'htmlentities'
gem 'httparty'
gem 'net-ssh'
gem 'net-sftp'
gem 'rsolr'
gem 'activerecord-import'
gem 'ar-extensions'
# Use unicorn as the web server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+)
# gem 'ruby-debug'
# gem 'ruby-debug19'
# Bundle the extra gems:
# gem 'bj'
# gem 'nokogiri'
# gem 'sqlite3-ruby', :require => 'sqlite3'
# gem 'aws-s3', :require => 'aws/s3'
# Gems for RSpec
# Bundle gems for the local environment. Make sure to
# put test-only gems in this group so their generators
# and rake tasks are available in development mode:
group :development, :test do
gem 'rspec-rails'
gem 'webrat'
gem 'rspec'
end
gem 'autotest'
spec_helper.rb:
# 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'
# 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}
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
config.mock_with :rspec
# 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 = false
end
test.rb:
CatalogService::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# and recreated between test runs. Don't rely on the data there!
config.cache_classes = true
# Log error messages when you accidentally call methods on nil.
config.whiny_nils = true
# Show full error reports and disable caching
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
# Raise exceptions instead of rendering exception templates
config.action_dispatch.show_exceptions = false
# Disable request forgery protection in test environment
config.action_controller.allow_forgery_protection = false
# Tell Action Mailer not to deliver emails to the real world.
# The :test delivery method accumulates sent emails in the
# ActionMailer::Base.deliveries array.
config.action_mailer.delivery_method = :test
# Use SQL instead of Active Record's schema dumper when creating the test 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
# Print deprecation notices to the stderr
config.active_support.deprecation = :stderr
end
Thanks for any thoughts in advance!
Looks like you were correct by adding spec_helper, and maybe put rsolr in a group => [:development, :production], because it looks like the test environment is loading Solr and failing for some reason?
You might check your default pattern. Looks like you said your files were named "spec/models/XXXX_test.rb" and rspec looks for the "_spec.rb" ending by default.