I'm attempting to update my existing rails app (3.0.3) to 3.1.0.beta1. I've install the rails gem and ran the bundle command to pull in all of the updated gems. When I run rake rails:update though I get:
rake aborted!
undefined method `join_asset_file_contents' for module `ActionView::Helpers::AssetTagHelper'
What am I doing wrong?
Trace Output
rake aborted!
undefined method `join_asset_file_contents' for module `ActionView::Helpers::AssetTagHelper'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.1.0.beta1/lib/active_support/core_ext/module/aliasing.rb:31:in `alias_method'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.1.0.beta1/lib/active_support/core_ext/module/aliasing.rb:31:in `alias_method_chain'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/smurf-1.0.6/lib/smurf.rb:15:in `<module:AssetTagHelper>'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/smurf-1.0.6/lib/smurf.rb:5:in `<top (required)>'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.13/lib/bundler/runtime.rb:68:in `require'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.13/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.13/lib/bundler/runtime.rb:66:in `each'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.13/lib/bundler/runtime.rb:66:in `block in require'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.13/lib/bundler/runtime.rb:55:in `each'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.13/lib/bundler/runtime.rb:55:in `require'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.13/lib/bundler.rb:120:in `require'
/Users/Kyle/Desktop/skateparks-web/config/application.rb:7:in `<top (required)>'
/Users/Kyle/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
/Users/Kyle/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
/Users/Kyle/Desktop/skateparks-web/Rakefile:1:in `<top (required)>'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:2383:in `load'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:2383:in `raw_load_rakefile'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:2017:in `block in load_rakefile'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:2016:in `load_rakefile'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:2000:in `block in run'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/bin/rake:31:in `<top (required)>'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/bin/rake:19:in `load'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/bin/rake:19:in `<main>'
After removing the Smurf Gem
DEPRECATION WARNING: class_inheritable_attribute is deprecated, please use class_attribute method instead. Notice their behavior are slightly different, so refer to class_attribute documentation first. (called from <top (required)> at /Users/Kyle/Desktop/skateparks-web/config/application.rb:7)
DEPRECATION WARNING: class_inheritable_attribute is deprecated, please use class_attribute method instead. Notice their behavior are slightly different, so refer to class_attribute documentation first. (called from <top (required)> at /Users/Kyle/Desktop/skateparks-web/config/application.rb:7)
** Invoke rails:update (first_time)
** Invoke rails:update:configs (first_time)
** Execute rails:update:configs
conflict config/boot.rb
Overwrite /Users/Kyle/Desktop/skateparks-web/config/boot.rb? (enter "h" for help) [Ynaqdh] y
force config/boot.rb
exist config
conflict config/routes.rb
Overwrite /Users/Kyle/Desktop/skateparks-web/config/routes.rb? (enter "h" for help) [Ynaqdh] n
skip config/routes.rb
conflict config/application.rb
Overwrite /Users/Kyle/Desktop/skateparks-web/config/application.rb? (enter "h" for help) [Ynaqdh] y
force config/application.rb
identical config/environment.rb
** Invoke rails:update:javascripts (first_time)
** Execute rails:update:javascripts
rake aborted!
undefined method `create_javascript_files' for #<Rails::Generators::AppGenerator:0x00000100fbb160>
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.1.0.beta1/lib/rails/tasks/framework.rake:40:in `invoke_from_app_generator'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.1.0.beta1/lib/rails/tasks/framework.rake:63:in `block (3 levels) in <top (required)>'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:636:in `block in execute'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:597:in `block in invoke_with_call_chain'
/Users/Kyle/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:607:in `block in invoke_prerequisites'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:604:in `each'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:604:in `invoke_prerequisites'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:596:in `block in invoke_with_call_chain'
/Users/Kyle/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:2029:in `block (2 levels) in top_level'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:2029:in `block in top_level'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:2001:in `block in run'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/bin/rake:31:in `<top (required)>'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/bin/rake:19:in `load'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p180/bin/rake:19:in `<main>'
join_asset_file_contents method is moved from
actionpack/lib/action_view/helpers/asset_tag_helper.rb
to
actionpack/lib/action_view/helpers/asset_tag_helpers/asset_include_tag.rb
That is the reason why you see this error.
Can you please run the rake command with --trace to see why join_asset_file_contents is being executed in the call graph?
Related
so first time working with rails i work with django
I tried deploying the local server and it failed because of a key error known as s3_bucket_name because I didn't have the ENV file which contained the variables
so then i got the ENV file and placed it in the root of the application.
then I tried to launch the app with no go.
Then I ran the command rake.
Which it complained:
C:\Users\chris\Documents\suitsandtables>rake
rake aborted!
Gem::LoadError: You have already activated rake 12.1.0, but your Gemfile requires rake 12.0.0. Prepending `bundle exec` to your command may solve this.
so then I ran what it suggested with --trace
and I got the same returned. What am I doing wrong?
C:\Users\chris\Documents\suitsandtables>bundle exec rake --trace
** Invoke default (first_time)
** Invoke test (first_time)
** Execute test
rake aborted!
KeyError: key not found: "S3_BUCKET_NAME"
C:/Users/chris/Documents/suitsandtables/config/initializers/s3.rb:4:in `fetch'
C:/Users/chris/Documents/suitsandtables/config/initializers/s3.rb:4:in `<top (required)>'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/activesupport-5.1.2/lib/active_support/dependencies.rb:286:in `load'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/activesupport-5.1.2/lib/active_support/dependencies.rb:286:in `block in load'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/activesupport-5.1.2/lib/active_support/dependencies.rb:258:in `load_dependency'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/activesupport-5.1.2/lib/active_support/dependencies.rb:286:in `load'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.1.2/lib/rails/engine.rb:655:in `block in load_config_initializer'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/activesupport-5.1.2/lib/active_support/notifications.rb:168:in `instrument'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.1.2/lib/rails/engine.rb:654:in `load_config_initializer'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.1.2/lib/rails/engine.rb:612:in `block (2 levels) in <class:Engine>'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.1.2/lib/rails/engine.rb:611:in `each'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.1.2/lib/rails/engine.rb:611:in `block in <class:Engine>'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.1.2/lib/rails/initializable.rb:30:in `instance_exec'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.1.2/lib/rails/initializable.rb:30:in `run'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.1.2/lib/rails/initializable.rb:59:in `block in run_initializers'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/2.3.0/tsort.rb:228:in `block in tsort_each'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/2.3.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/2.3.0/tsort.rb:422:in `block (2 levels) in each_strongly_connected_component_from'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/2.3.0/tsort.rb:431:in `each_strongly_connected_component_from'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/2.3.0/tsort.rb:421:in `block in each_strongly_connected_component_from'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.1.2/lib/rails/initializable.rb:48:in `each'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.1.2/lib/rails/initializable.rb:48:in `tsort_each_child'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/2.3.0/tsort.rb:415:in `call'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/2.3.0/tsort.rb:415:in `each_strongly_connected_component_from'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/2.3.0/tsort.rb:349:in `block in each_strongly_connected_component'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/2.3.0/tsort.rb:347:in `each'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/2.3.0/tsort.rb:347:in `call'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/2.3.0/tsort.rb:347:in `each_strongly_connected_component'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/2.3.0/tsort.rb:226:in `tsort_each'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/2.3.0/tsort.rb:205:in `tsort_each'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.1.2/lib/rails/initializable.rb:58:in `run_initializers'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.1.2/lib/rails/application.rb:353:in `initialize!'
C:/Users/chris/Documents/suitsandtables/config/environment.rb:5:in `<top (required)>'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/activesupport-5.1.2/lib/active_support/dependencies.rb:292:in `require'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/activesupport-5.1.2/lib/active_support/dependencies.rb:292:in `block in require'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/activesupport-5.1.2/lib/active_support/dependencies.rb:258:in `load_dependency'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/activesupport-5.1.2/lib/active_support/dependencies.rb:292:in `require'
C:/Users/chris/Documents/suitsandtables/test/test_helper.rb:1:in `<top (required)>'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/activesupport-5.1.2/lib/active_support/dependencies.rb:292:in `require'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/activesupport-5.1.2/lib/active_support/dependencies.rb:292:in `block in require'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/activesupport-5.1.2/lib/active_support/dependencies.rb:258:in `load_dependency'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/activesupport-5.1.2/lib/active_support/dependencies.rb:292:in `require'
C:/Users/chris/Documents/suitsandtables/test/controllers/menus_controller_test.rb:1:in `<top (required)>'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/activesupport-5.1.2/lib/active_support/dependencies.rb:292:in `require'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/activesupport-5.1.2/lib/active_support/dependencies.rb:292:in `block in require'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/activesupport-5.1.2/lib/active_support/dependencies.rb:258:in `load_dependency'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/activesupport-5.1.2/lib/active_support/dependencies.rb:292:in `require'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.1.2/lib/rails/test_unit/test_requirer.rb:14:in `block in require_files'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.1.2/lib/rails/test_unit/test_requirer.rb:13:in `each'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.1.2/lib/rails/test_unit/test_requirer.rb:13:in `require_files'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.1.2/lib/rails/test_unit/minitest_plugin.rb:67:in `rake_run'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.1.2/lib/rails/test_unit/testing.rake:14:in `block in <top (required)>'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/rake-12.0.0/lib/rake/task.rb:250:in `block in execute'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/rake-12.0.0/lib/rake/task.rb:250:in `each'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/rake-12.0.0/lib/rake/task.rb:250:in `execute'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/rake-12.0.0/lib/rake/task.rb:194:in `block in invoke_with_call_chain'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/rake-12.0.0/lib/rake/task.rb:187:in `invoke_with_call_chain'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/rake-12.0.0/lib/rake/task.rb:216:in `block in invoke_prerequisites'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/rake-12.0.0/lib/rake/task.rb:214:in `each'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/rake-12.0.0/lib/rake/task.rb:214:in `invoke_prerequisites'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/rake-12.0.0/lib/rake/task.rb:193:in `block in invoke_with_call_chain'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/rake-12.0.0/lib/rake/task.rb:187:in `invoke_with_call_chain'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/rake-12.0.0/lib/rake/task.rb:180:in `invoke'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/rake-12.0.0/lib/rake/application.rb:152:in `invoke_task'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/rake-12.0.0/lib/rake/application.rb:108:in `block (2 levels) in top_level'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/rake-12.0.0/lib/rake/application.rb:108:in `each'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/rake-12.0.0/lib/rake/application.rb:108:in `block in top_level'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/rake-12.0.0/lib/rake/application.rb:117:in `run_with_threads'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/rake-12.0.0/lib/rake/application.rb:102:in `top_level'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/rake-12.0.0/lib/rake/application.rb:80:in `block in run'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/rake-12.0.0/lib/rake/application.rb:178:in `standard_exception_handling'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/rake-12.0.0/lib/rake/application.rb:77:in `run'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/rake-12.0.0/exe/rake:27:in `<top (required)>'
C:/RailsInstaller/Ruby2.3.3/bin/rake:22:in `load'
C:/RailsInstaller/Ruby2.3.3/bin/rake:22:in `<main>'
Tasks: TOP => default => test
the contents of the env file is as follows with sensitive info removed
S3_BUCKET_NAME=sat-paperclip-prod-heroku
AWS_ACCESS_KEY_ID= removed
AWS_SECRET_ACCESS_KEY= removed
AWS_REGION=us-east-1
GOOGLE_API_KEY= removed
can i get some help please
The error is caused by using Hash#fetch in config/initializers/s3.rb. That's a good thing. Don't change that. Your app requires that ENV value to work correctly, so it breaks if it's not set. (Everything within config/initializers/ runs on startup. This s3.rb file is not part of Rails core and was added by the app's author.)
Make sure your Gemfile has dotenv-rails specified. If it doesn't, add it (see https://github.com/bkeepers/dotenv) and type bundle in the terminal from your Rails root directory. (Note that dotenv-rails is also not part of Rails core.)
The root of your Rails app is the directory containing containing the files Gemfile, Gemfile.lock, etc. and the directories app/, bin/, config/, db/, lib/, etc. (i.e. C:/Users/chris/Documents/suitsandtables/). You can confirm by jumping into the Rails console (rails c or bundle exec rails c in the terminal) and typing Rails.root.
The env file should be named .env (thus the name of gem: dotenv) and should be located in your Rails root directory.
You can test your .env file through rails c by typing:
# in the rails console
ENV # your whole environment in a Hash
ENV["S3_BUCKET_NAME"] # your bucket name
Test all the environment values you're looking for. CaSe MaTtErS.
If you have any Rails servers or tasks running, restart them to pick up these changes.
The expected result of typing bundle exec rake is to run the tests. If you want to run the app itself, use rails s or bundle exec rails s.
p.s. Don't git add/commit your .env. It contains secrets. Make sure it is gitignored.
I am on Rails 5.1, and on a Mac running Sierra. I've already read and tried the solutions listed on other similar questions (1, 2). I have 3 different Rails projects that I'm working on and have rails-erd installed on all of them, but it is not working on one of them.
When I run rails ert --trace:
>rails erd --trace
** Invoke erd (first_time)
** Invoke erd:generate (first_time)
** Invoke erd:check_dependencies (first_time)
** Execute erd:check_dependencies
** Invoke erd:options (first_time)
** Execute erd:options
** Invoke erd:load_models (first_time)
** Execute erd:load_models
Loading application environment...
** Invoke environment (first_time)
** Execute environment
Loading code in search of Active Record models...
** Execute erd:generate
Generating Entity-Relationship Diagram for 13 models...
rails aborted!
Saving diagram failed!
Verify that Graphviz is installed and in your path, or use filetype=dot.
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rails-erd-1.5.2/lib/rails_erd/diagram/graphviz.rb:211:in `rescue in block in <class:Graphviz>'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rails-erd-1.5.2/lib/rails_erd/diagram/graphviz.rb:202:in `block in <class:Graphviz>'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rails-erd-1.5.2/lib/rails_erd/diagram.rb:169:in `instance_eval'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rails-erd-1.5.2/lib/rails_erd/diagram.rb:169:in `save'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rails-erd-1.5.2/lib/rails_erd/diagram.rb:120:in `create'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rails-erd-1.5.2/lib/rails_erd/diagram.rb:74:in `create'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rails-erd-1.5.2/lib/rails_erd/tasks.rake:55:in `block (2 levels) in <top (required)>'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/task.rb:250:in `block in execute'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/task.rb:250:in `each'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/task.rb:250:in `execute'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/task.rb:194:in `block in invoke_with_call_chain'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/2.4.0/monitor.rb:214:in `mon_synchronize'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/task.rb:187:in `invoke_with_call_chain'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/task.rb:216:in `block in invoke_prerequisites'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/task.rb:214:in `each'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/task.rb:214:in `invoke_prerequisites'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/task.rb:193:in `block in invoke_with_call_chain'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/2.4.0/monitor.rb:214:in `mon_synchronize'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/task.rb:187:in `invoke_with_call_chain'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/task.rb:180:in `invoke'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/application.rb:152:in `invoke_task'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/application.rb:108:in `block (2 levels) in top_level'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/application.rb:108:in `each'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/application.rb:108:in `block in top_level'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/application.rb:117:in `run_with_threads'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/application.rb:102:in `top_level'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.1.2/lib/rails/commands/rake/rake_command.rb:21:in `block in perform'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/application.rb:178:in `standard_exception_handling'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.1.2/lib/rails/commands/rake/rake_command.rb:18:in `perform'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.1.2/lib/rails/command.rb:46:in `invoke'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.1.2/lib/rails/commands.rb:16:in `<top (required)>'
/Users/jaysonwhelpley/Sites/biq/bin/rails:9:in `require'
/Users/jaysonwhelpley/Sites/biq/bin/rails:9:in `<top (required)>'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `load'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `call'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/client/command.rb:7:in `call'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/client.rb:30:in `run'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/spring-2.0.2/bin/spring:49:in `<top (required)>'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `load'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `<top (required)>'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:68:in `require'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:68:in `require'
/Users/jaysonwhelpley/Sites/biq/bin/spring:15:in `<top (required)>'
bin/rails:3:in `load'
bin/rails:3:in `<main>'
NoMethodError: undefined method `zero?' for nil:NilClass
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/ruby-graphviz-1.2.3/lib/graphviz/utils.rb:58:in `output_from_command'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/ruby-graphviz-1.2.3/lib/graphviz.rb:600:in `output'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rails-erd-1.5.2/lib/rails_erd/diagram/graphviz.rb:204:in `block in <class:Graphviz>'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rails-erd-1.5.2/lib/rails_erd/diagram.rb:169:in `instance_eval'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rails-erd-1.5.2/lib/rails_erd/diagram.rb:169:in `save'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rails-erd-1.5.2/lib/rails_erd/diagram.rb:120:in `create'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rails-erd-1.5.2/lib/rails_erd/diagram.rb:74:in `create'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rails-erd-1.5.2/lib/rails_erd/tasks.rake:55:in `block (2 levels) in <top (required)>'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/task.rb:250:in `block in execute'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/task.rb:250:in `each'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/task.rb:250:in `execute'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/task.rb:194:in `block in invoke_with_call_chain'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/2.4.0/monitor.rb:214:in `mon_synchronize'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/task.rb:187:in `invoke_with_call_chain'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/task.rb:216:in `block in invoke_prerequisites'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/task.rb:214:in `each'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/task.rb:214:in `invoke_prerequisites'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/task.rb:193:in `block in invoke_with_call_chain'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/2.4.0/monitor.rb:214:in `mon_synchronize'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/task.rb:187:in `invoke_with_call_chain'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/task.rb:180:in `invoke'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/application.rb:152:in `invoke_task'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/application.rb:108:in `block (2 levels) in top_level'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/application.rb:108:in `each'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/application.rb:108:in `block in top_level'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/application.rb:117:in `run_with_threads'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/application.rb:102:in `top_level'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.1.2/lib/rails/commands/rake/rake_command.rb:21:in `block in perform'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/application.rb:178:in `standard_exception_handling'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.1.2/lib/rails/commands/rake/rake_command.rb:18:in `perform'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.1.2/lib/rails/command.rb:46:in `invoke'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.1.2/lib/rails/commands.rb:16:in `<top (required)>'
/Users/jaysonwhelpley/Sites/biq/bin/rails:9:in `require'
/Users/jaysonwhelpley/Sites/biq/bin/rails:9:in `<top (required)>'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `load'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `call'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/client/command.rb:7:in `call'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/client.rb:30:in `run'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/spring-2.0.2/bin/spring:49:in `<top (required)>'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `load'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `<top (required)>'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:68:in `require'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:68:in `require'
/Users/jaysonwhelpley/Sites/biq/bin/spring:15:in `<top (required)>'
bin/rails:3:in `load'
bin/rails:3:in `<main>'
Tasks: TOP => erd => erd:generate
I have already installed graphviz.
The rake erd filetype=dot command works just fine, but trying the option of using:
erd --inheritance --direct --attributes=foreign_keys,content --filetype=dot
dot -Tjpg erd.dot > erd.jpg
It just creates an empty erd.jpg.
Any help?
I was having a similar problem, what I did was the following:
Put the following patch on initializers, you can find the explanation here ERD issue:
require 'rails_erd/domain/relationship'
module RailsERD
class Domain
class Relationship
class << self
private
def association_identity(association)
Set[association_owner(association), association_target(association)]
end
end
end
end
end
Generate the dot file
rake erd filetype=dot --trace
Generate the pdf file
dot -Tpdf -oERD.pdf -v erd.dot
On a Rails 3.2 application
Gemfile:
gem "state_machine", "~> 1.1.2"
gem 'ruby-graphviz', :require => 'graphviz'
I installed and use with success the state_machine gem, only when I try to draw the state graph
rake state_machine:draw CLASS=Entity
it throws me this error:
** Invoke state_machine:draw (first_time)
** Execute state_machine:draw
** Invoke environment (first_time)
** Execute environment
rake aborted!
uninitialized constant StateMachine::Machine::Constants
/Users/joel/.rvm/gems/ruby-1.9.2-p290#biowatts/gems/state_machine-1.1.2/lib/state_machine/machine.rb:1898:in `draw'
/Users/joel/.rvm/gems/ruby-1.9.2-p290#biowatts/gems/state_machine-1.1.2/lib/state_machine/machine.rb:481:in `block (2 levels) in draw'
/Users/joel/.rvm/gems/ruby-1.9.2-p290#biowatts/gems/state_machine-1.1.2/lib/state_machine/machine.rb:480:in `each_value'
/Users/joel/.rvm/gems/ruby-1.9.2-p290#biowatts/gems/state_machine-1.1.2/lib/state_machine/machine.rb:480:in `block in draw'
/Users/joel/.rvm/gems/ruby-1.9.2-p290#biowatts/gems/state_machine-1.1.2/lib/state_machine/machine.rb:472:in `each'
/Users/joel/.rvm/gems/ruby-1.9.2-p290#biowatts/gems/state_machine-1.1.2/lib/state_machine/machine.rb:472:in `draw'
/Users/joel/.rvm/gems/ruby-1.9.2-p290#biowatts/gems/state_machine-1.1.2/lib/tasks/state_machine.rb:27:in `block (2 levels) in <top (required)>'
/Users/joel/.rvm/gems/ruby-1.9.2-p290#global/gems/rake-10.1.0/lib/rake/task.rb:236:in `call'
/Users/joel/.rvm/gems/ruby-1.9.2-p290#global/gems/rake-10.1.0/lib/rake/task.rb:236:in `block in execute'
/Users/joel/.rvm/gems/ruby-1.9.2-p290#global/gems/rake-10.1.0/lib/rake/task.rb:231:in `each'
/Users/joel/.rvm/gems/ruby-1.9.2-p290#global/gems/rake-10.1.0/lib/rake/task.rb:231:in `execute'
/Users/joel/.rvm/gems/ruby-1.9.2-p290#global/gems/rake-10.1.0/lib/rake/task.rb:175:in `block in invoke_with_call_chain'
/Users/joel/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/Users/joel/.rvm/gems/ruby-1.9.2-p290#global/gems/rake-10.1.0/lib/rake/task.rb:168:in `invoke_with_call_chain'
/Users/joel/.rvm/gems/ruby-1.9.2-p290#global/gems/rake-10.1.0/lib/rake/task.rb:161:in `invoke'
/Users/joel/.rvm/gems/ruby-1.9.2-p290#global/gems/rake-10.1.0/lib/rake/application.rb:149:in `invoke_task'
/Users/joel/.rvm/gems/ruby-1.9.2-p290#global/gems/rake-10.1.0/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/Users/joel/.rvm/gems/ruby-1.9.2-p290#global/gems/rake-10.1.0/lib/rake/application.rb:106:in `each'
/Users/joel/.rvm/gems/ruby-1.9.2-p290#global/gems/rake-10.1.0/lib/rake/application.rb:106:in `block in top_level'
/Users/joel/.rvm/gems/ruby-1.9.2-p290#global/gems/rake-10.1.0/lib/rake/application.rb:115:in `run_with_threads'
/Users/joel/.rvm/gems/ruby-1.9.2-p290#global/gems/rake-10.1.0/lib/rake/application.rb:100:in `top_level'
/Users/joel/.rvm/gems/ruby-1.9.2-p290#global/gems/rake-10.1.0/lib/rake/application.rb:78:in `block in run'
/Users/joel/.rvm/gems/ruby-1.9.2-p290#global/gems/rake-10.1.0/lib/rake/application.rb:165:in `standard_exception_handling'
/Users/joel/.rvm/gems/ruby-1.9.2-p290#global/gems/rake-10.1.0/lib/rake/application.rb:75:in `run'
/Users/joel/.rvm/gems/ruby-1.9.2-p290#global/gems/rake-10.1.0/bin/rake:33:in `<top (required)>'
/Users/joel/.rvm/gems/ruby-1.9.2-p290#global/bin/rake:19:in `load'
/Users/joel/.rvm/gems/ruby-1.9.2-p290#global/bin/rake:19:in `<main>'
/Users/joel/.rvm/gems/ruby-1.9.2-p290#biowatts/bin/ruby_noexec_wrapper:14:in `eval'
/Users/joel/.rvm/gems/ruby-1.9.2-p290#biowatts/bin/ruby_noexec_wrapper:14:in `<main>'
Tasks: TOP => state_machine:draw
Any leads on how to troubleshoot this one?
Dirty but works:
unless defined? StateMachine::Machine::Constants::RGV_VERSION
warn "StateMachine::Machine::Constants overriden in #{__FILE__}"
class StateMachine::Machine::Constants
RGV_VERSION = /^[ ]*ruby-graphviz \(([0-9.]+)\)/.match(`cat #{Rails.root.join 'Gemfile.lock'}`)[1]
end
end
To elaborate on tsiruu answer: in case you are using rails, just take his code and put it in an initializer
unless defined? StateMachine::Machine::Constants::RGV_VERSION
warn "StateMachine::Machine::Constants overriden in #{__FILE__}"
class StateMachine::Machine::Constants
RGV_VERSION = /^[ ]*ruby-graphviz \(([0-9.]+)\)/.match(`cat #{Rails.root.join 'Gemfile.lock'}`)[1]
end
end
I'm trying to set up my development environment to work with an existing project that's using Mongoid. I've run bundle install and that worked fine, but I'm now trying to set up the database, and I'm running rake db:setup
Here's the output:
[1] $ rake db:setup --trace ✘
** Invoke db:setup (first_time)
** Invoke db:create (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.+
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/bundler/gems/cantango-36e3ce152717/lib/cantango/configuration/registry.rb:31:in `register'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/bundler/gems/cantango-36e3ce152717/lib/cantango/configuration/candidate_registry.rb:10:in `register'
/home/chintanparikh/Documents/Work/project_name/config/initializers/cantango.rb:8:in `block in <top (required)>'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/bundler/gems/cantango-36e3ce152717/lib/cantango.rb:23:in `configure'
/home/chintanparikh/Documents/Work/project_name/config/initializers/cantango.rb:2:in `<top (required)>'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:234:in `load'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:234:in `block in load'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:223:in `block in load_dependency'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:640:in `new_constants_in'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:223:in `load_dependency'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:234:in `load'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.1.3/lib/rails/engine.rb:556:in `block (2 levels) in <class:Engine>'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.1.3/lib/rails/engine.rb:555:in `each'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.1.3/lib/rails/engine.rb:555:in `block in <class:Engine>'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.1.3/lib/rails/initializable.rb:30:in `instance_exec'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.1.3/lib/rails/initializable.rb:30:in `run'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.1.3/lib/rails/initializable.rb:55:in `block in run_initializers'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.1.3/lib/rails/initializable.rb:54:in `each'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.1.3/lib/rails/initializable.rb:54:in `run_initializers'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.1.3/lib/rails/application.rb:96:in `initialize!'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.1.3/lib/rails/railtie/configurable.rb:30:in `method_missing'
/home/chintanparikh/Documents/Work/project_name/config/environment.rb:5:in `<top (required)>'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `require'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `block in require'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:223:in `block in load_dependency'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:640:in `new_constants_in'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:223:in `load_dependency'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `require'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.1.3/lib/rails/application.rb:83:in `require_environment!'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.1.3/lib/rails/application.rb:193:in `block (2 levels) in initialize_tasks'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/lib/rake/task.rb:227:in `call'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/lib/rake/task.rb:227:in `block in execute'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/lib/rake/task.rb:222:in `each'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/lib/rake/task.rb:222:in `execute'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/lib/rake/task.rb:166:in `block in invoke_with_call_chain'
/home/chintanparikh/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/lib/rake/task.rb:159:in `invoke_with_call_chain'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/lib/rake/task.rb:187:in `block in invoke_prerequisites'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/lib/rake/task.rb:185:in `each'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/lib/rake/task.rb:185:in `invoke_prerequisites'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/lib/rake/task.rb:165:in `block in invoke_with_call_chain'
/home/chintanparikh/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/lib/rake/task.rb:159:in `invoke_with_call_chain'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/lib/rake/task.rb:187:in `block in invoke_prerequisites'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/lib/rake/task.rb:185:in `each'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/lib/rake/task.rb:185:in `invoke_prerequisites'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/lib/rake/task.rb:165:in `block in invoke_with_call_chain'
/home/chintanparikh/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/lib/rake/task.rb:159:in `invoke_with_call_chain'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/lib/rake/task.rb:152:in `invoke'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/lib/rake/application.rb:141:in `invoke_task'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/lib/rake/application.rb:99:in `block (2 levels) in top_level'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/lib/rake/application.rb:99:in `each'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/lib/rake/application.rb:99:in `block in top_level'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/lib/rake/application.rb:108:in `run_with_threads'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/lib/rake/application.rb:93:in `top_level'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/lib/rake/application.rb:71:in `block in run'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/lib/rake/application.rb:158:in `standard_exception_handling'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/lib/rake/application.rb:68:in `run'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/bin/rake:37:in `<top (required)>'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/bin/rake:19:in `load'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/bin/rake:19:in `<main>'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/bin/ruby_noexec_wrapper:14:in `eval'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/bin/ruby_noexec_wrapper:14:in `<main>'
Tasks: TOP => db:setup => db:create => environment
Does anyone know how to fix this? It looks like it's failing on the create step.
Cheers.
MongoDB is a schema-less database. You don't need to use any of the rake db:{} functions with it. The only thing you need to do to have mongodb up and running is to install it and then to start the server. You can find more information on installing MongoDB here
When I try and run a RAKE on Webistrano I get the following error:
undefined method `name' for "actionmailer":String`
I am a not proficient in Ruby and RoR but I have installed and played about with plenty of applications before and I can't find what the issue is.
The command I am running is:
RAILS_ENV=production rake db:migrate --trace
Which produces the below:
I would really like to know the best way to diagnose and fix this issue and issues like it in the future.
(in /srv/www/webistrano)
WARNING: 'require 'rake/rdoctask'' is deprecated. Please use 'require 'rdoc/task' (in RDoc 2.4.2+)' instead.
at /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/rdoctask.rb
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
undefined method `name' for "actionmailer":String
/srv/www/webistrano/vendor/rails/railties/lib/rails/gem_dependency.rb:268:in `=='
/usr/local/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:217:in `==='
/usr/local/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:217:in `block in matching_specs'
/usr/local/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:411:in `block in each'
/usr/local/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:410:in `each'
/usr/local/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:410:in `each'
/usr/local/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:216:in `find_all'
/usr/local/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:216:in `matching_specs'
/usr/local/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:238:in `to_specs'
/usr/local/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
/usr/local/lib/ruby/site_ruby/1.9.1/rubygems.rb:1231:in `gem'
/srv/www/webistrano/vendor/rails/railties/lib/rails/gem_dependency.rb:73:in `add_load_paths'
/srv/www/webistrano/vendor/rails/railties/lib/initializer.rb:301:in `block in add_gem_load_paths'
/srv/www/webistrano/vendor/rails/railties/lib/initializer.rb:301:in `each'
/srv/www/webistrano/vendor/rails/railties/lib/initializer.rb:301:in `add_gem_load_paths'
/srv/www/webistrano/vendor/rails/railties/lib/initializer.rb:132:in `process'
/srv/www/webistrano/vendor/rails/railties/lib/initializer.rb:113:in `run'
/srv/www/webistrano/config/environment.rb:16:in `<top (required)>'
/usr/local/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
/usr/local/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
/srv/www/webistrano/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in `block in require'
/srv/www/webistrano/vendor/rails/activesupport/lib/active_support/dependencies.rb:521:in `new_constants_in'
/srv/www/webistrano/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in `require'
/srv/www/webistrano/vendor/rails/railties/lib/tasks/misc.rake:4:in `block in <top (required)>'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `block in execute'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/usr/local/lib/ruby/1.9.1/monitor.rb:190:in `mon_synchronize'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:176:in `block in invoke_prerequisites'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:174:in `each'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:174:in `invoke_prerequisites'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:157:in `block in invoke_with_call_chain'
/usr/local/lib/ruby/1.9.1/monitor.rb:190:in `mon_synchronize'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block (2 levels) in top_level'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block in top_level'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `block in run'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
/usr/local/bin/rake:23:in `load'
/usr/local/bin/rake:23:in `<main>'
Tasks: TOP => db:migrate => environment
When I run ruby -v I get the following:
ruby 1.9.1p376 (2009-12-07 revision 26041) [i686-linux]
I had this problem.
The solution is to downgrade rubygems to a version you support.
I needed version 1.3.5 (for rails 2.3.5)
So you need to do:
gem install rubygems-update -v 1.3.5
update_rubygems --version=1.3.5
And now rake should work.
This worked for me.
rvm rubygems 1.6.2