Getting error with ancestry gem - ruby-on-rails

I am trying to add ancestry to an Event_Tags model that I have. Right now that model only has a name. I added 'ancestry' to the gemfile and bundled. Now when I go to run the following command:
rails g migration AddAncestryToEventTags ancestry:string
I get the following error:
/Users/stevenbrooks1111/.rvm/gems/ruby-1.9.3-p429/gems/ancestry- 2.0.0/lib/ancestry/has_ancestry.rb:7:in `block in has_ancestry': Unknown option for has_ancestry: :hierarchy_class_name => "TagHierarchy". (Ancestry::AncestryException)
Not sure why why this is coming up. I have been following the Ancestry railscast episode as well as the documentation.
This is also the same error I am getting when simply trying to run the rails console.
Here is the entire message:
/Users/stevenbrooks1111/.rvm/gems/ruby-1.9.3-p429/gems/ancestry-2.0.0/lib/ancestry/has_ancestry.rb:7:in `block in has_ancestry': Unknown option for has_ancestry: :hierarchy_class_name => "TagHierarchy". (Ancestry::AncestryException)
from /Users/stevenbrooks1111/.rvm/gems/ruby-1.9.3-p429/gems/ancestry-2.0.0/lib/ancestry/has_ancestry.rb:5:in `each'
from /Users/stevenbrooks1111/.rvm/gems/ruby-1.9.3-p429/gems/ancestry-2.0.0/lib/ancestry/has_ancestry.rb:5:in `has_ancestry'
from /Users/stevenbrooks1111/Code/freelance/GRN-Auth/config/initializers/tag_patch.rb:3:in `<class:Tag>'
from /Users/stevenbrooks1111/Code/freelance/GRN-Auth/config/initializers/tag_patch.rb:2:in `<module:ActsAsTaggableOn>'
from /Users/stevenbrooks1111/Code/freelance/GRN-Auth/config/initializers/tag_patch.rb:1:in `<top (required)>'
from /Users/stevenbrooks1111/.rvm/gems/ruby-1.9.3-p429/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:245:in `load'
from /Users/stevenbrooks1111/.rvm/gems/ruby-1.9.3-p429/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:245:in `block in load'
from /Users/stevenbrooks1111/.rvm/gems/ruby-1.9.3-p429/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:236:in `load_dependency'
from /Users/stevenbrooks1111/.rvm/gems/ruby-1.9.3-p429/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:245:in `load'
from /Users/stevenbrooks1111/.rvm/gems/ruby-1.9.3-p429/gems/railties-3.2.11/lib/rails/engine.rb:588:in `block (2 levels) in <class:Engine>'
from /Users/stevenbrooks1111/.rvm/gems/ruby-1.9.3-p429/gems/railties-3.2.11/lib/rails/engine.rb:587:in `each'
from /Users/stevenbrooks1111/.rvm/gems/ruby-1.9.3-p429/gems/railties-3.2.11/lib/rails/engine.rb:587:in `block in <class:Engine>'
from /Users/stevenbrooks1111/.rvm/gems/ruby-1.9.3-p429/gems/railties-3.2.11/lib/rails/initializable.rb:30:in `instance_exec'
from /Users/stevenbrooks1111/.rvm/gems/ruby-1.9.3-p429/gems/railties-3.2.11/lib/rails/initializable.rb:30:in `run'
from /Users/stevenbrooks1111/.rvm/gems/ruby-1.9.3-p429/gems/railties-3.2.11/lib/rails/initializable.rb:55:in `block in run_initializers'
from /Users/stevenbrooks1111/.rvm/gems/ruby-1.9.3-p429/gems/railties-3.2.11/lib/rails/initializable.rb:54:in `each'
from /Users/stevenbrooks1111/.rvm/gems/ruby-1.9.3-p429/gems/railties-3.2.11/lib/rails/initializable.rb:54:in `run_initializers'
from /Users/stevenbrooks1111/.rvm/gems/ruby-1.9.3-p429/gems/railties-3.2.11/lib/rails/application.rb:136:in `initialize!'
from /Users/stevenbrooks1111/.rvm/gems/ruby-1.9.3-p429/gems/railties-3.2.11/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /Users/stevenbrooks1111/Code/freelance/GRN-Auth/config/environment.rb:14:in `<top (required)>'
from /Users/stevenbrooks1111/.rvm/gems/ruby-1.9.3-p429/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require'
from /Users/stevenbrooks1111/.rvm/gems/ruby-1.9.3-p429/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `block in require'
from /Users/stevenbrooks1111/.rvm/gems/ruby-1.9.3-p429/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:236:in `load_dependency'
from /Users/stevenbrooks1111/.rvm/gems/ruby-1.9.3-p429/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require'
from /Users/stevenbrooks1111/.rvm/gems/ruby-1.9.3-p429/gems/railties-3.2.11/lib/rails/application.rb:103:in `require_environment!'
from /Users/stevenbrooks1111/.rvm/gems/ruby-1.9.3-p429/gems/railties-3.2.11/lib/rails/commands.rb:40:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'

One possible reason, which in my case was true, there are two different engines using ancestry and acts_as_tree.
Engine1, requires ancestry in gemspec.
Engine2, requires acts_as_tree in gemspec.
If engine1 is placed above engine2 in gemfile, ancestry gem is loaded first. In which case, this code executes and overrides acts_as_tree function. One way to fix this is put Engine2 over Engine1 in gemfile.
I haven't been able to figure out a better way to fix this, please let me know if you become aware of any.

Related

There was an error while trying to load the gem 'rails-api'. (Bundler::GemRequireError)

I am working with Rails 5.0.0.beta3 and creating a rails-api. when i run
rails-api generate scaffold user email:string password:string auth_token:string
it shows the error
.rvm/gems/ruby-2.2.3/gems/bundler-1.11.2/lib/bundler/runtime.rb:80:in `rescue in block (2 levels) in require': There was an error while trying to load the gem 'rails-api'. (Bundler::GemRequireError)
from /home/ahsanul/.rvm/gems/ruby-2.2.3/gems/bundler-1.11.2/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
from /home/ahsanul/.rvm/gems/ruby-2.2.3/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `each'
from /home/ahsanul/.rvm/gems/ruby-2.2.3/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `block in require'
from /home/ahsanul/.rvm/gems/ruby-2.2.3/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `each'
from /home/ahsanul/.rvm/gems/ruby-2.2.3/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `require'
from /home/ahsanul/.rvm/gems/ruby-2.2.3/gems/bundler-1.11.2/lib/bundler.rb:99:in `require'
from /home/ahsanul/Documents/rails-api/my_blog/config/application.rb:7:in `<top (required)>'
from /home/ahsanul/.rvm/gems/ruby-2.2.3/gems/spring-1.7.1/lib/spring/application.rb:82:in `require'
from /home/ahsanul/.rvm/gems/ruby-2.2.3/gems/spring-1.7.1/lib/spring/application.rb:82:in `preload'
from /home/ahsanul/.rvm/gems/ruby-2.2.3/gems/spring-1.7.1/lib/spring/application.rb:143:in `serve'
from /home/ahsanul/.rvm/gems/ruby-2.2.3/gems/spring-1.7.1/lib/spring/application.rb:131:in `block in run'
from /home/ahsanul/.rvm/gems/ruby-2.2.3/gems/spring-1.7.1/lib/spring/application.rb:125:in `loop'
from /home/ahsanul/.rvm/gems/ruby-2.2.3/gems/spring-1.7.1/lib/spring/application.rb:125:in `run'
from /home/ahsanul/.rvm/gems/ruby-2.2.3/gems/spring-1.7.1/lib/spring/application/boot.rb:19:in `<top (required)>'
from /home/ahsanul/.rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /home/ahsanul/.rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from -e:1:in `<main>'
How can i resolve the problem?
You don't need to include rails-api gem in your Rails 5 app's Gemfile. It's already merged into Rails 5.
Reference
I tried all the above suggestion from Babar but didn't work, so i tried one little thing that work which is adding gem 'listen' to the gem file.
it works for me!!
rails-api generate scaffold user email:string password:string auth_token:string
No need of writing rails-api, just use rails. Rails::API has been merged into Rails 5.0, so no need of gem 'rails-api'.So remove it from gemfile.After than you may get error when you try to migrate.So you have to include listen gem.

undefined method `eager_load' when upgrading to formtastic 3.1

I'm using Ruby 1.9.3 and Rails 3.2.17 for this project. I plan to upgrade to Rails 4 but meet a lot gem incompatibilities, so I try to update some gem at first.
I am updating formtastic from 2.0.2 to 3.1.3.
I see a lot of deprecation warnings like this:
DEPRECATION WARNING: input_class is deprecated and will be removed from Formtastic 4.0 (configure Formtastic::FormBuilder.input_class_finder instead (upgrade guide on wiki: http://bit.ly/1F9QtKc )). (called from _app_views_prescriptions__fields_html_haml___278490936240938991_103076320 at /home/hegwin/Workspace/rails_projects/pharmmd/app/views/prescriptions/_fields.html.haml:7)
And I followed formtastic wiki Upgrading to Formtastic 3.1 , and I added these two lines to config/initializers/formtastic.rb
Formtastic::FormBuilder.action_class_finder = Formtastic::ActionClassFinder
Formtastic::FormBuilder.input_class_finder = Formtastic::InputClassFinder
After that when I tried to run the rspec, it threw an error:
NoMethodError: undefined method `eager_load' for #<Rails::Application::Configuration:0x00000006306a50>
/home/hegwin/.rvm/gems/ruby-1.9.3-p362#medpro/gems/railties-3.2.17/lib/rails/railtie/configuration.rb:85:in `method_missing': undefined method `eager_load' for #<Rails::Application::Configuration:0x00000006459b50> (NoMethodError)
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362#medpro/gems/formtastic-3.1.3/lib/formtastic/namespaced_class_finder.rb:32:in `use_const_defined?'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362#medpro/gems/formtastic-3.1.3/lib/formtastic/namespaced_class_finder.rb:69:in `<class:NamespacedClassFinder>'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362#medpro/gems/formtastic-3.1.3/lib/formtastic/namespaced_class_finder.rb:24:in `<module:Formtastic>'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362#medpro/gems/formtastic-3.1.3/lib/formtastic/namespaced_class_finder.rb:1:in `<top (required)>'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362#medpro/gems/formtastic-3.1.3/lib/formtastic/action_class_finder.rb:7:in `<module:Formtastic>'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362#medpro/gems/formtastic-3.1.3/lib/formtastic/action_class_finder.rb:1:in `<top (required)>'
from /home/hegwin/Workspace/rails_projects/pharmmd/config/initializers/formtastic.rb:104:in `<top (required)>'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362#medpro/gems/zeus-0.13.3/lib/zeus/load_tracking.rb:50:in `load'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362#medpro/gems/zeus-0.13.3/lib/zeus/load_tracking.rb:50:in `load'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362#medpro/gems/zeus-0.13.3/lib/zeus/load_tracking.rb:43:in `load'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362#medpro/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:245:in `block in load'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362#medpro/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:236:in `load_dependency'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362#medpro/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:245:in `load'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362#medpro/gems/railties-3.2.17/lib/rails/engine.rb:593:in `block (2 levels) in <class:Engine>'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362#medpro/gems/railties-3.2.17/lib/rails/engine.rb:592:in `each'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362#medpro/gems/railties-3.2.17/lib/rails/engine.rb:592:in `block in <class:Engine>'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362#medpro/gems/railties-3.2.17/lib/rails/initializable.rb:30:in `instance_exec'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362#medpro/gems/railties-3.2.17/lib/rails/initializable.rb:30:in `run'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362#medpro/gems/railties-3.2.17/lib/rails/initializable.rb:55:in `block in run_initializers'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362#medpro/gems/railties-3.2.17/lib/rails/initializable.rb:54:in `each'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362#medpro/gems/railties-3.2.17/lib/rails/initializable.rb:54:in `run_initializers'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362#medpro/gems/railties-3.2.17/lib/rails/application.rb:136:in `initialize!'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362#medpro/gems/railties-3.2.17/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /home/hegwin/Workspace/rails_projects/pharmmd/config/environment.rb:5:in `<top (required)>'
from /home/hegwin/Workspace/rails_projects/pharmmd/spec/spec_helper.rb:12:in `require'
from /home/hegwin/Workspace/rails_projects/pharmmd/spec/spec_helper.rb:12:in `<top (required)>'
from /home/hegwin/Workspace/rails_projects/pharmmd/spec/features/patient_edit_medication.feature:1:in `require'
from /home/hegwin/Workspace/rails_projects/pharmmd/spec/features/patient_edit_medication.feature:1:in `<top (required)>'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362#medpro/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:in `load'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362#medpro/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:in `block in load_spec_files'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362#medpro/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:in `each'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362#medpro/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:in `load_spec_files'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362#medpro/gems/rspec-core-2.13.1/lib/rspec/core/command_line.rb:22:in `run'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362#medpro/gems/rspec-core-2.13.1/lib/rspec/core/runner.rb:80:in `run'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362#medpro/gems/rspec-core-2.13.1/lib/rspec/core/runner.rb:17:in `block in autorun'
The issue is known to the formtastic team. See issues #1137 and #1135 for details. In short, a stop-gap measure is to utilize the issue_1135 branch of the sepastian fork. Here's the Gemfile line:
gem 'formtastic', :git => 'git://github.com/sepastian/formtastic.git', :branch => 'issue_1135'
A better idea is to fork that branch to create your own repository.

sorcery occured error on rails4 on using mongoid gem

I wanna use sorcery gem using user authentication and mongid gem
add Gemfile to
gem 'sorcery'
$ bundle
$ rails g sorcery:install core reset_password
I was success using activerecord...
but mongoid not make defualt sorcery initial files..
why not make initial files
help expert persons :(
This is deprecated, in future versions you may need to `bundle binstub rails` to work around a system/bundle conflict.
/Users/user_name/.rvm/gems/ruby-2.1.0/gems/activesupport-4.1.0/lib/active_support/concern.rb:126:in `included': Cannot define multiple 'included' blocks for a Concern (ActiveSupport::Concern::MultipleIncludedBlocks)
from /Users/user_name/.rvm/gems/ruby-2.1.0/gems/sorcery-0.8.5/lib/sorcery.rb:73:in `block in <module:Sorcery>'
from /Users/user_name/.rvm/gems/ruby-2.1.0/gems/sorcery-0.8.5/lib/sorcery.rb:72:in `module_eval'
from /Users/user_name/.rvm/gems/ruby-2.1.0/gems/sorcery-0.8.5/lib/sorcery.rb:72:in `<module:Sorcery>'
from /Users/user_name/.rvm/gems/ruby-2.1.0/gems/sorcery-0.8.5/lib/sorcery.rb:1:in `<top (required)>'
from /Users/user_name/.rvm/gems/ruby-2.1.0/gems/bundler-1.6.2/lib/bundler/runtime.rb:76:in `require'
from /Users/user_name/.rvm/gems/ruby-2.1.0/gems/bundler-1.6.2/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
from /Users/user_name/.rvm/gems/ruby-2.1.0/gems/bundler-1.6.2/lib/bundler/runtime.rb:72:in `each'
from /Users/user_name/.rvm/gems/ruby-2.1.0/gems/bundler-1.6.2/lib/bundler/runtime.rb:72:in `block in require'
from /Users/user_name/.rvm/gems/ruby-2.1.0/gems/bundler-1.6.2/lib/bundler/runtime.rb:61:in `each'
from /Users/user_name/.rvm/gems/ruby-2.1.0/gems/bundler-1.6.2/lib/bundler/runtime.rb:61:in `require'
from /Users/user_name/.rvm/gems/ruby-2.1.0/gems/bundler-1.6.2/lib/bundler.rb:132:in `require'
from /Users/user_name/Desktop/rails/project/config/application.rb:14:in `<top (required)>'
from /Users/user_name/.rvm/gems/ruby-2.1.0/gems/spring-1.1.3/lib/spring/application.rb:82:in `require'
from /Users/user_name/.rvm/gems/ruby-2.1.0/gems/spring-1.1.3/lib/spring/application.rb:82:in `preload'
from /Users/user_name/.rvm/gems/ruby-2.1.0/gems/spring-1.1.3/lib/spring/application.rb:140:in `serve'
from /Users/user_name/.rvm/gems/ruby-2.1.0/gems/spring-1.1.3/lib/spring/application.rb:128:in `block in run'
from /Users/user_name/.rvm/gems/ruby-2.1.0/gems/spring-1.1.3/lib/spring/application.rb:122:in `loop'
from /Users/user_name/.rvm/gems/ruby-2.1.0/gems/spring-1.1.3/lib/spring/application.rb:122:in `run'
from /Users/user_name/.rvm/gems/ruby-2.1.0/gems/spring-1.1.3/lib/spring/application/boot.rb:18:in `<top (required)>'
from /Users/user_name/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/user_name/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'

Is DS_Store needed for Rails? Cannot start Rails 3.2.12 or run Rails console because of dependency on DS_Store on OS X

We cannot run Rails on OS X because of some dependency on .DS_Store. We cannot even run the Rails console. Is this needed? Should we remove .DS_Store? We don't have this problem, with the same code, on Windows.
We're on Rails 3.2.12.
Thanks!
Stack trace below:
willclark:t c$ rails console
REQUIRING DEPENDENCY: .
REQUIRING DEPENDENCY: ..
REQUIRING DEPENDENCY: .DS_Store
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:317:in `rescue in depend_on': No such file to load -- .DS_Store (LoadError)
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:312:in `depend_on'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:225:in `require_dependency'
from /Users/c/Desktop/Sites/t/config/initializers/dev_classes_dependency.rb:4:in `block in <top (required)>'
from /Users/c/Desktop/Sites/t/config/initializers/dev_classes_dependency.rb:2:in `foreach'
from /Users/c/Desktop/Sites/t/config/initializers/dev_classes_dependency.rb:2:in `<top (required)>'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:245:in `load'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:245:in `block in load'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:236:in `load_dependency'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:245:in `load'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/railties-3.2.12/lib/rails/engine.rb:588:in `block (2 levels) in <class:Engine>'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/railties-3.2.12/lib/rails/engine.rb:587:in `each'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/railties-3.2.12/lib/rails/engine.rb:587:in `block in <class:Engine>'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/railties-3.2.12/lib/rails/initializable.rb:30:in `instance_exec'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/railties-3.2.12/lib/rails/initializable.rb:30:in `run'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/railties-3.2.12/lib/rails/initializable.rb:55:in `block in run_initializers'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/railties-3.2.12/lib/rails/initializable.rb:54:in `each'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/railties-3.2.12/lib/rails/initializable.rb:54:in `run_initializers'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/railties-3.2.12/lib/rails/application.rb:136:in `initialize!'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/railties-3.2.12/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /Users/c/Desktop/Sites/t/config/environment.rb:5:in `<top (required)>'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/railties-3.2.12/lib/rails/application.rb:103:in `require'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/railties-3.2.12/lib/rails/application.rb:103:in `require_environment!'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/railties-3.2.12/lib/rails/commands.rb:40:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
You need to look into your config/initializers/dev_classes_dependency.rb and remove dependency in there. As mentioned by user2062950, this should be obsolete, but you should probably ask your project leader or anyone who will know why this dependency has been added.
If you have troubles with removing those dependencies, please update your question with the content of this file.

What should I do to make this rails app testable?

I have an up to date rails application, using rails 3.2 with mongoid 2. I was unable to start testing by typing rake. The exception thrown is (sanitized):
rake test
/railsapp/app/models/image.rb:18:in `<class:Image>': undefined method `[]' for nil:NilClass (NoMethodError)
from /railsapp/app/models/image.rb:1:in `<top (required)>'
from /gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `require'
from /gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `block in require'
from /gems/activesupport-3.2.8/lib/active_support/dependencies.rb:236:in `load_dependency'
from /gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `require'
from /gems/activesupport-3.2.8/lib/active_support/dependencies.rb:359:in `require_or_load'
from /gems/activesupport-3.2.8/lib/active_support/dependencies.rb:313:in `depend_on'
from /gems/activesupport-3.2.8/lib/active_support/dependencies.rb:225:in `require_dependency'
from /gems/railties-3.2.8/lib/rails/engine.rb:439:in `block (2 levels) in eager_load!'
from /gems/railties-3.2.8/lib/rails/engine.rb:438:in `each'
from /gems/railties-3.2.8/lib/rails/engine.rb:438:in `block in eager_load!'
from /gems/railties-3.2.8/lib/rails/engine.rb:436:in `each'
from /gems/railties-3.2.8/lib/rails/engine.rb:436:in `eager_load!'
from /gems/railties-3.2.8/lib/rails/application/finisher.rb:53:in `block in <module:Finisher>'
from /gems/railties-3.2.8/lib/rails/initializable.rb:30:in `instance_exec'
from /gems/railties-3.2.8/lib/rails/initializable.rb:30:in `run'
from /gems/railties-3.2.8/lib/rails/initializable.rb:55:in `block in run_initializers'
from /gems/railties-3.2.8/lib/rails/initializable.rb:54:in `each'
from /gems/railties-3.2.8/lib/rails/initializable.rb:54:in `run_initializers'
from /gems/railties-3.2.8/lib/rails/application.rb:136:in `initialize!'
from /gems/railties-3.2.8/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /railsapp/config/environment.rb:7:in `<top (required)>'
from /railsapp/test/test_helper.rb:2:in `require'
from /railsapp/test/test_helper.rb:2:in `<top (required)>'
from /railsapp/test/unit/post_test.rb:1:in `require'
from /railsapp/test/unit/post_test.rb:1:in `<top (required)>'
from /gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:10:in `require'
from /gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:10:in `block (2 levels) in <main>'
from /gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:9:in `each'
from /gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:9:in `block in <main>'
from /gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:4:in `select'
from /gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:4:in `<main>'
Errors running test:units! #<RuntimeError: Command failed with status (1): [/Users/janlimpens/.rvm/rubies/ruby-1.9.3-p...]>
I created a gist with the files that are of interest in the context:
https://gist.github.com/3989760
There is no test concerning the image model at all, there are no fixtures and the only test I have got is included into the gist, but it is not to blame, the error is thrown upon including test_helper.rb.
What are my options?
When the tests start Rails loads up, as it does so it evaluates all of your models.
This includes the Image model, which apparently has a bug or typo on line 18.
Which would be this line:
:path => "#{APP_CONFIG['uploads_dir']}/:class/:id/:attachment/:style.:extension",
The only array notation here is:
APP_CONFIG['uploads_dir']
So, where is APP_CONFIG defined? And why is it a nil? These are the questions we must answer.
You might start by grepping your project for this string.

Resources