rails I18n fails to find proper translation file on validation failure - ruby-on-rails

I'm in the process of upgrading a 3.0.20 app to 4.x. This was done by starting with a blank rails4 directory and adding code/tests.
Things are going well thanks to lots of rspec tests.
When some of the test fail due to validation errors (which are expected), I am getting complaints from I18n, which appears to be trying to load a directory as a translation file.
I18n::UnknownFileType: can not load translations from $MYLONGPATH/beaumont4/lib, the file type is not known
from (irb):10:in `load_file'
from /home/mcr/.rvm/gems/ruby-2.1.5/gems/i18n-0.7.0/lib/i18n/backend/base.rb:15:in `block in load_translations'
from /home/mcr/.rvm/gems/ruby-2.1.5/gems/i18n-0.7.0/lib/i18n/backend/base.rb:15:in `each'
from /home/mcr/.rvm/gems/ruby-2.1.5/gems/i18n-0.7.0/lib/i18n/backend/base.rb:15:in `load_translations'
from /home/mcr/.rvm/gems/ruby-2.1.5/gems/i18n-0.7.0/lib/i18n/backend/simple.rb:57:in `init_translations'
from /home/mcr/.rvm/gems/ruby-2.1.5/gems/i18n-0.7.0/lib/i18n/backend/simple.rb:40:in `available_locales'
from /home/mcr/.rvm/gems/ruby-2.1.5/gems/i18n-0.7.0/lib/i18n/config.rb:43:in `available_locales'
from /home/mcr/.rvm/gems/ruby-2.1.5/gems/i18n-0.7.0/lib/i18n/config.rb:49:in `available_locales_set'
from /home/mcr/.rvm/gems/ruby-2.1.5/gems/i18n-0.7.0/lib/i18n.rb:278:in `locale_available?'
from /home/mcr/.rvm/gems/ruby-2.1.5/gems/i18n-0.7.0/lib/i18n.rb:284:in `enforce_available_locales!'
from /home/mcr/.rvm/gems/ruby-2.1.5/gems/i18n-0.7.0/lib/i18n.rb:151:in `translate'
from /home/mcr/.rvm/gems/ruby-2.1.5/gems/activemodel-4.2.5/lib/active_model/naming.rb:188:in `human'
from /home/mcr/.rvm/gems/ruby-2.1.5/gems/activemodel-4.2.5/lib/active_model/errors.rb:437:in `generate_message'
from /home/mcr/.rvm/gems/ruby-2.1.5/gems/activemodel-4.2.5/lib/active_model/errors.rb:449:in `normalize_message'
from /home/mcr/.rvm/gems/ruby-2.1.5/gems/activemodel-4.2.5/lib/active_model/errors.rb:300:in `add'
from /home/mcr/.rvm/gems/ruby-2.1.5/gems/activemodel-4.2.5/lib/active_model/validations/length.rb:57:in `block in validate_each'
... 40 levels...
from /home/mcr/.rvm/gems/ruby-2.1.5/gems/railties-4.2.5/lib/rails/commands/console.rb:9:in `start'
from /home/mcr/.rvm/gems/ruby-2.1.5/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:68:in `console'
from /home/mcr/.rvm/gems/ruby-2.1.5/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /home/mcr/.rvm/gems/ruby-2.1.5/gems/railties-4.2.5/lib/rails/commands.rb:17:in `<top (required)>'
from /home/mcr/.rvm/gems/ruby-2.1.5/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:274:in `require'
from /home/mcr/.rvm/gems/ruby-2.1.5/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:274:in `block in require'
from /home/mcr/.rvm/gems/ruby-2.1.5/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:240:in `load_dependency'
from /home/mcr/.rvm/gems/ruby-2.1.5/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:274:in `require'
from /net/galaxy/home/mcr1002/nv/clientportaltest/beaumont4/bin/rails:9:in `<top (required)>'
from /home/mcr/.rvm/gems/ruby-2.1.5/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:268:in `load'
from /home/mcr/.rvm/gems/ruby-2.1.5/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:268:in `block in load'
from /home/mcr/.rvm/gems/ruby-2.1.5/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:240:in `load_dependency'
from /home/mcr/.rvm/gems/ruby-2.1.5/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:268:in `load'
from /home/mcr/.rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /home/mcr/.rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require'

I determined finally that the problem was that my I18path was borked by me.
I did:
config.i18n.load_path += Dir[Rails.root.join('lib').to_s]
The I18n.loadpath does not take directories, but files.
I meant to do:
config.autoload_paths += Dir[Rails.root.join('lib').to_s]
ID10T error.

Related

Rails Console Error Output

I just recently updated Ruby(2.3.1) and Rails(5.0.0.1). Now, when I get an error ( any type of error) on the rails console, it's followed by about 15-20 lines starting with 'from/Users....../.rvm/..etc'. Any idea why I am getting so many lines of this error output and if it's normal? How could I fix it? Everything else regarding Ruby/Rails works perfectly fine for me otherwise, so maybe it's just normal output. However, it is a bit of an annoyance.
The commonality in each path seems to be '.rvm'.
For example:
2.3.1 :031 > test
ArgumentError: wrong number of arguments (given 0, expected 2..3)
from (irb):31:in `test'
from (irb):31
from /Users/AlfonsoGiron/.rvm/gems/ruby-2.3.1#global/gems/railties-5.0.0.1/lib/rails/commands/console.rb:65:in `start'
from /Users/AlfonsoGiron/.rvm/gems/ruby-2.3.1#global/gems/railties-5.0.0.1/lib/rails/commands/console_helper.rb:9:in `start'
from /Users/AlfonsoGiron/.rvm/gems/ruby-2.3.1#global/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:78:in `console'
from /Users/AlfonsoGiron/.rvm/gems/ruby-2.3.1#global/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
from /Users/AlfonsoGiron/.rvm/gems/ruby-2.3.1#global/gems/railties-5.0.0.1/lib/rails/commands.rb:18:in `<top (required)>'
from /Users/AlfonsoGiron/.rvm/gems/ruby-2.3.1#global/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `require'
from /Users/AlfonsoGiron/.rvm/gems/ruby-2.3.1#global/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `block in require'
from /Users/AlfonsoGiron/.rvm/gems/ruby-2.3.1#global/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:259:in `load_dependency'
from /Users/AlfonsoGiron/.rvm/gems/ruby-2.3.1#global/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `require'
from /Users/AlfonsoGiron/workspace/sample_app/bin/rails:9:in `<top (required)>'
from /Users/AlfonsoGiron/.rvm/gems/ruby-2.3.1#global/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:287:in `load'
from /Users/AlfonsoGiron/.rvm/gems/ruby-2.3.1#global/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:287:in `block in load'
from /Users/AlfonsoGiron/.rvm/gems/ruby-2.3.1#global/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:259:in `load_dependency'
from /Users/AlfonsoGiron/.rvm/gems/ruby-2.3.1#global/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:287:in `load'
from /Users/AlfonsoGiron/.rvm/gems/ruby-2.3.1/gems/spring-1.7.2/lib/spring/commands/rails.rb:6:in `call'
from /Users/AlfonsoGiron/.rvm/gems/ruby-2.3.1/gems/spring-1.7.2/lib/spring/command_wrapper.rb:38:in `call'
from /Users/AlfonsoGiron/.rvm/gems/ruby-2.3.1/gems/spring-1.7.2/lib/spring/application.rb:191:in `block in serve'
from /Users/AlfonsoGiron/.rvm/gems/ruby-2.3.1/gems/spring-1.7.2/lib/spring/application.rb:161:in `fork'
from /Users/AlfonsoGiron/.rvm/gems/ruby-2.3.1/gems/spring-1.7.2/lib/spring/application.rb:161:in `serve'
from /Users/AlfonsoGiron/.rvm/gems/ruby-2.3.1/gems/spring-1.7.2/lib/spring/application.rb:131:in `block in run'
from /Users/AlfonsoGiron/.rvm/gems/ruby-2.3.1/gems/spring-1.7.2/lib/spring/application.rb:125:in `loop'
from /Users/AlfonsoGiron/.rvm/gems/ruby-2.3.1/gems/spring-1.7.2/lib/spring/application.rb:125:in `run'
from /Users/AlfonsoGiron/.rvm/gems/ruby-2.3.1/gems/spring-1.7.2/lib/spring/application/boot.rb:19:in `<top (required)>'
from /Users/AlfonsoGiron/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/AlfonsoGiron/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from -e:1:in `<main>'
2.3.1 :032 >
Thanks for any help.
Rails console uses IRB under the covers, so you're going to have to edit your IRB configuration file, usually located at ~/irbrc, and change the BACK_TRACE_LIMIT value:
IRB.conf[:BACK_TRACE_LIMIT]=0
During a Rails console session, you can also run:
conf.back_trace_limit = 0
There are many more configuration options for IRB (and by extension, Rails console). Check them out at ruby-doc.org.

Ruby on Rails : Error when trying generating template (AdminLTE2)

Please help me, i'm a new ruby/rails programmer, and I want to try a free dashboard admin (AdminLTE2), but i got a problem when trying to install it, i can generate it,
im already add "gem 'adminlte2-rails'" to Gemfile, and the gem was successfully deteced in rails generate option.
i have already googling the error code too, but found nothing.
i'm using all newest ruby(2.2.2) technology, gem 2.4.8, rails 4.2.1. Thanks
and sorry for my bad English.
g40#Lenovo-G40:~/Sites/TestSites$ bin/rails generate admin_lte2
insert app/assets/stylesheets/application.scss
/home/g40/.rvm/gems/ruby-2.2.2/gems/thor-0.19.1/lib/thor/actions/inject_into_file.rb:98:in `binread': No such file or directory # rb_sysopen - /home/g40/Sites/TestSites/app/assets/stylesheets/application.scss (Errno::ENOENT)
from /home/g40/.rvm/gems/ruby-2.2.2/gems/thor-0.19.1/lib/thor/actions/inject_into_file.rb:98:in `replace!'
from /home/g40/.rvm/gems/ruby-2.2.2/gems/thor-0.19.1/lib/thor/actions/inject_into_file.rb:59:in `invoke!'
from /home/g40/.rvm/gems/ruby-2.2.2/gems/thor-0.19.1/lib/thor/actions.rb:94:in `action'
from /home/g40/.rvm/gems/ruby-2.2.2/gems/thor-0.19.1/lib/thor/actions/inject_into_file.rb:30:in `insert_into_file'
from /home/g40/.rvm/gems/ruby-2.2.2/gems/adminlte2-rails-0.0.6/lib/generators/admin_lte2/admin_lte2_generator.rb:8:in `main'
from /home/g40/.rvm/gems/ruby-2.2.2/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
from /home/g40/.rvm/gems/ruby-2.2.2/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
from /home/g40/.rvm/gems/ruby-2.2.2/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `block in invoke_all'
from /home/g40/.rvm/gems/ruby-2.2.2/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `each'
from /home/g40/.rvm/gems/ruby-2.2.2/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `map'
from /home/g40/.rvm/gems/ruby-2.2.2/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `invoke_all'
from /home/g40/.rvm/gems/ruby-2.2.2/gems/thor-0.19.1/lib/thor/group.rb:232:in `dispatch'
from /home/g40/.rvm/gems/ruby-2.2.2/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
from /home/g40/.rvm/gems/ruby-2.2.2/gems/railties-4.2.1/lib/rails/generators.rb:157:in `invoke'
from /home/g40/.rvm/gems/ruby-2.2.2/gems/railties-4.2.1/lib/rails/commands/generate.rb:13:in `<top (required)>'
from /home/g40/.rvm/gems/ruby-2.2.2/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in `require'
from /home/g40/.rvm/gems/ruby-2.2.2/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in `block in require'
from /home/g40/.rvm/gems/ruby-2.2.2/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:240:in `load_dependency'
from /home/g40/.rvm/gems/ruby-2.2.2/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in `require'
from /home/g40/.rvm/gems/ruby-2.2.2/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:123:in `require_command!'
from /home/g40/.rvm/gems/ruby-2.2.2/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:130:in `generate_or_destroy'
from /home/g40/.rvm/gems/ruby-2.2.2/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:50:in `generate'
from /home/g40/.rvm/gems/ruby-2.2.2/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /home/g40/.rvm/gems/ruby-2.2.2/gems/railties-4.2.1/lib/rails/commands.rb:17:in `<top (required)>'
from /home/g40/.rvm/gems/ruby-2.2.2/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in `require'
from /home/g40/.rvm/gems/ruby-2.2.2/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in `block in require'
from /home/g40/.rvm/gems/ruby-2.2.2/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:240:in `load_dependency'
from /home/g40/.rvm/gems/ruby-2.2.2/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in `require'
from /home/g40/Sites/TestSites/bin/rails:8:in `<top (required)>'
from /home/g40/.rvm/gems/ruby-2.2.2/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:268:in `load'
from /home/g40/.rvm/gems/ruby-2.2.2/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:268:in `block in load'
from /home/g40/.rvm/gems/ruby-2.2.2/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:240:in `load_dependency'
from /home/g40/.rvm/gems/ruby-2.2.2/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:268:in `load'
from /home/g40/.rvm/rubies/ruby-2.2.2/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /home/g40/.rvm/rubies/ruby-2.2.2/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from -e:1:in `<main>'
Your error output contains the following line:
/home/.../inject_into_file.rb:98:in `binread': No such file or directory # rb_sysopen - /home/g40/Sites/TestSites/app/assets/stylesheets/application.scss (Errno::ENOENT)
You have to create the app/assets/stylesheets/application.scss file manually.

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.

Bundler.require fails in clean Rails project

My rails app fails to load when I have the following line in application.rb:
Bundler.require(:default, Rails.env)
I get the following error:
.rvm/gems/ruby-2.0.0-p353#global/gems/railties-4.0.2/lib/rails/initializable.rb:13:in `[]': no implicit conversion of Symbol into Integer (TypeError)
from /Users/gerardkelly/.rvm/gems/ruby-2.0.0-p353#global/gems/railties-4.0.2/lib/rails/initializable.rb:13:in `initialize'
from /Users/gerardkelly/.rvm/gems/ruby-2.0.0-p353#global/gems/railties-4.0.2/lib/rails/initializable.rb:85:in `new'
from /Users/gerardkelly/.rvm/gems/ruby-2.0.0-p353#global/gems/railties-4.0.2/lib/rails/initializable.rb:85:in `initializer'
from /Users/gerardkelly/.rvm/gems/ruby-2.0.0-p353#rails-4.0/gems/rolify-3.3.0/lib/rolify/railtie.rb:6:in `<class:Railtie>'
from /Users/gerardkelly/.rvm/gems/ruby-2.0.0-p353#rails-4.0/gems/rolify-3.3.0/lib/rolify/railtie.rb:5:in `<module:Rolify>'
from /Users/gerardkelly/.rvm/gems/ruby-2.0.0-p353#rails-4.0/gems/rolify-3.3.0/lib/rolify/railtie.rb:4:in `<top (required)>'
from /Users/gerardkelly/.rvm/gems/ruby-2.0.0-p353#global/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require'
from /Users/gerardkelly/.rvm/gems/ruby-2.0.0-p353#global/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `block in require'
from /Users/gerardkelly/.rvm/gems/ruby-2.0.0-p353#global/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:214:in `load_dependency'
from /Users/gerardkelly/.rvm/gems/ruby-2.0.0-p353#global/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require'
from /Users/gerardkelly/.rvm/gems/ruby-2.0.0-p353#rails-4.0/gems/rolify-3.3.0/lib/rolify.rb:1:in `<top (required)>'
from /Users/gerardkelly/.rvm/gems/ruby-2.0.0-p353#global/gems/bundler-1.5.1/lib/bundler/runtime.rb:76:in `require'
from /Users/gerardkelly/.rvm/gems/ruby-2.0.0-p353#global/gems/bundler-1.5.1/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
from /Users/gerardkelly/.rvm/gems/ruby-2.0.0-p353#global/gems/bundler-1.5.1/lib/bundler/runtime.rb:72:in `each'
from /Users/gerardkelly/.rvm/gems/ruby-2.0.0-p353#global/gems/bundler-1.5.1/lib/bundler/runtime.rb:72:in `block in require'
from /Users/gerardkelly/.rvm/gems/ruby-2.0.0-p353#global/gems/bundler-1.5.1/lib/bundler/runtime.rb:61:in `each'
from /Users/gerardkelly/.rvm/gems/ruby-2.0.0-p353#global/gems/bundler-1.5.1/lib/bundler/runtime.rb:61:in `require'
from /Users/gerardkelly/.rvm/gems/ruby-2.0.0-p353#global/gems/bundler-1.5.1/lib/bundler.rb:131:in `require'
from /Users/gerardkelly/Web Development/Rails Apps/Rails 4/po-app/config/application.rb:5:in `<top (required)>'
from /Users/gerardkelly/.rvm/gems/ruby-2.0.0-p353#global/gems/railties-4.0.2/lib/rails/commands.rb:74:in `require'
from /Users/gerardkelly/.rvm/gems/ruby-2.0.0-p353#global/gems/railties-4.0.2/lib/rails/commands.rb:74:in `block in <top (required)>'
from /Users/gerardkelly/.rvm/gems/ruby-2.0.0-p353#global/gems/railties-4.0.2/lib/rails/commands.rb:71:in `tap'
from /Users/gerardkelly/.rvm/gems/ruby-2.0.0-p353#global/gems/railties-4.0.2/lib/rails/commands.rb:71:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
Looks as though it's complaining about the params being sent in - which is odd because this is pre-baked Rails stuff. Note that the Bundler.require is application.rb:5 which its complaining about.
I'm on Rails 4, Ruby 2.0.0
Looks like the rollify gem you are using (so it's not clean rails project :P) has some issues in rails 4.x series.
Check this out: https://github.com/EppO/rolify/pull/218 there is a fork that already fixes that.

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