Rails doesn’t seem to be loading the Kaminari gem, as I get an Uninitialized constant error when starting up the development server:
/home/my_app/config/initializers/kaminari_config.rb:1:in `<top (required)>': uninitialized constant Kaminari (NameError)
from /home/ramses/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.1/lib/rails/engine.rb:588:in `block (2 levels) in <class:Engine>'
from /home/ramses/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.1/lib/rails/engine.rb:587:in `each'
from /home/ramses/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.1/lib/rails/engine.rb:587:in `block in <class:Engine>'
from /home/ramses/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.1/lib/rails/initializable.rb:30:in `instance_exec'
from /home/ramses/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.1/lib/rails/initializable.rb:30:in `run'
from /home/ramses/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.1/lib/rails/initializable.rb:55:in `block in run_initializers'
from /home/ramses/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.1/lib/rails/initializable.rb:54:in `each'
from /home/ramses/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.1/lib/rails/initializable.rb:54:in `run_initializers'
from /home/ramses/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.1/lib/rails/application.rb:136:in `initialize!'
from /home/ramses/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.1/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /home/my_app/config/environment.rb:5:in `<top (required)>'
However, I’m including it on the Gemfile, and running gem list shows that it is installed, as well. Any ideas? How can I track down this Uninitialized constant error?
Thanks!
My Gemfile:
source ‘https://rubygems.org’
gem 'rails', '3.2.1'
gem 'jquery-rails'
gem 'blueprint-rails'
gem 'mysql2'
gem 'kaminari'
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem "therubyracer", :require => 'v8'
gem 'uglifier', '>= 1.0.3'
end
group :development do
gem 'rvm-capistrano'
gem 'capistrano'
end
My gem list
$ gem list
actionmailer (3.2.1)
actionpack (3.2.2, 3.2.1)
activemodel (3.2.2, 3.2.1)
activerecord (3.2.1)
activeresource (3.2.1)
activesupport (3.2.2, 3.2.1)
arel (3.0.0)
blueprint-rails (0.1.2)
builder (3.0.0)
bundler (1.0.22 ruby, 1.0.21)
capistrano (2.12.0)
coffee-rails (3.2.2)
coffee-script (2.2.0)
coffee-script-source (1.2.0)
daemon_controller (1.0.0)
erubis (2.7.0)
execjs (1.3.0)
fastthread (1.0.7)
highline (1.6.12)
hike (1.2.1)
i18n (0.6.0)
journey (1.0.1)
jquery-rails (2.0.0)
jruby-jars (1.6.7)
jruby-rack (1.1.4)
json (1.6.5)
kaminari (0.13.0)
libv8 (3.3.10.4 x86-linux)
mail (2.4.1)
mime-types (1.17.2)
multi_json (1.0.4)
mysql2 (0.3.11)
net-scp (1.0.4)
net-sftp (2.0.5)
net-ssh (2.3.0)
net-ssh-gateway (1.1.0)
passenger (3.0.11)
polyglot (0.3.3)
rack (1.4.1)
rack-cache (1.1)
rack-ssl (1.3.2)
rack-test (0.6.1)
rails (3.2.1)
railties (3.2.1)
rake (0.9.2.2)
rdoc (3.12)
rubyzip (0.9.6.1)
rvm (1.11.3.3)
rvm-capistrano (1.1.0)
sass (3.1.14)
sass-rails (3.2.4)
sprockets (2.1.2)
therubyracer (0.10.1)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10)
tzinfo (0.3.31)
uglifier (1.2.3)
I can see you’re using RVM to manage different ruby versions and different gemsets (sets of gems specific to each application). That’s great.
But you’re running the
gemcommand outside rvm — meaning it’s not necessarily showing what rvm has set up for the specific ruby version you’re using. It may also be that kaminari is on your machine, but not in the bundle for that application yet.It may simply be that you’ve switched RVM rubies and not run bundle.
Can you run
bundle installfrom your project root and verify that Kaminari is installed for that project’s bundle?