I want to create a rails project in which I won't need a database.
I like to do things in a clean way, without leaving traces behing, so I thought I'd remove all db-like gems from the project.
I started my app with
rails new test_app --skip-activerecord
Then I went on to remove the gems associated with databases by commenting out the line
gem 'sqlite3'
After a bundle install
, no errors appeared, so I thought everything was fine.
The problem started when I tried to generate a new controller.
When I type rails generate controller my_controller
I get this big stack trace
/usr/local/rvm/gems/ruby-2.1.5@rails4/gems/activerecord-4.2.0/lib/active_record/connection_adapters/connection_specification.rb:177:in `rescue in spec': Specified 'sqlite3' for database adapter, but the gem is not loaded. Add `gem 'sqlite3'` to your Gemfile (and ensure its version is at the minimum required by ActiveRecord). (Gem::LoadError)
from /usr/local/rvm/gems/ruby-2.1.5@rails4/gems/activerecord-4.2.0/lib/active_record/connection_adapters/connection_specification.rb:174:in `spec'
from /usr/local/rvm/gems/ruby-2.1.5@rails4/gems/activerecord-4.2.0/lib/active_record/connection_handling.rb:50:in `establish_connection'
from /usr/local/rvm/gems/ruby-2.1.5@rails4/gems/activerecord-4.2.0/lib/active_record/railtie.rb:120:in `block (2 levels) in <class:Railtie>'
from /usr/local/rvm/gems/ruby-2.1.5@rails4/gems/activesupport-4.2.0/lib/active_support/lazy_load_hooks.rb:38:in `instance_eval'
from /usr/local/rvm/gems/ruby-2.1.5@rails4/gems/activesupport-4.2.0/lib/active_support/lazy_load_hooks.rb:38:in `execute_hook'
from /usr/local/rvm/gems/ruby-2.1.5@rails4/gems/activesupport-4.2.0/lib/active_support/lazy_load_hooks.rb:45:in `block in run_load_hooks'
from /usr/local/rvm/gems/ruby-2.1.5@rails4/gems/activesupport-4.2.0/lib/active_support/lazy_load_hooks.rb:44:in `each'
from /usr/local/rvm/gems/ruby-2.1.5@rails4/gems/activesupport-4.2.0/lib/active_support/lazy_load_hooks.rb:44:in `run_load_hooks'
from /usr/local/rvm/gems/ruby-2.1.5@rails4/gems/activerecord-4.2.0/lib/active_record/base.rb:316:in `<module:ActiveRecord>'
from /usr/local/rvm/gems/ruby-2.1.5@rails4/gems/activerecord-4.2.0/lib/active_record/base.rb:26:in `<top (required)>'
from /usr/local/rvm/gems/ruby-2.1.5@rails4/gems/spring-1.3.6/lib/spring/application.rb:319:in `active_record_configured?'
from /usr/local/rvm/gems/ruby-2.1.5@rails4/gems/spring-1.3.6/lib/spring/application.rb:251:in `disconnect_database'
from /usr/local/rvm/gems/ruby-2.1.5@rails4/gems/spring-1.3.6/lib/spring/application.rb:97:in `preload'
from /usr/local/rvm/gems/ruby-2.1.5@rails4/gems/spring-1.3.6/lib/spring/application.rb:143:in `serve'
from /usr/local/rvm/gems/ruby-2.1.5@rails4/gems/spring-1.3.6/lib/spring/application.rb:131:in `block in run'
from /usr/local/rvm/gems/ruby-2.1.5@rails4/gems/spring-1.3.6/lib/spring/application.rb:125:in `loop'
from /usr/local/rvm/gems/ruby-2.1.5@rails4/gems/spring-1.3.6/lib/spring/application.rb:125:in `run'
from /usr/local/rvm/gems/ruby-2.1.5@rails4/gems/spring-1.3.6/lib/spring/application/boot.rb:18:in `<top (required)>'
from /usr/local/rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /usr/local/rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from -e:1:in `<main>'
essentially it seems to be telling me that I need my sqlite3 gem back, but wait: didn't I specify I don't want Active Record in my project? Why is it complaining?
I later discovered that removing the sqlite3 gem also prevents me from doing other stuff, such as running rails g -h
(which leads to the same stack trace).
That hints me the problem is not necessarily related to ActiveRecord, but with some config file requiring sqlite3, but where is it?
Thanks in advance for the help.