Ruby on Rails and SQLite3

After upgrading to Fedora 17, I had to re-install Ruby on Rails.  I’m using Rails 3.2.7 with the news updates.  In the past I’ve always use MySQL server as the database, so I’ve always installed the database, drivers and associated gems.  Usually it takes an hour or two to get everything setup and working correctly.

Today I had the need to use SQLite.  The app I’m writing needs to have the data files local.  SQLite is the default database for Ruby on Rails, so I figured it would be no issue.  Wrong.

With installing rails, I installed all the Gems, not thinking that I was logged in as root.  Apparently the SQLite3 gem does not update the GEM_HOME environment variable correctly when you are logged in as root.

After many hours of frustration I came across a note where someone else resolved the error by uninstalling the SQLite Gem, making sure all remnants of the gem were gone and then re-installing it.  By “making sure all remnants…were gone”, I mean I had to make sure the sqlite3 gem no longer appeared when I ran the “gem list –local command”.  Since I had installed somethings as root and some as myself, I had to run the gem uninstall as different users until I had gotten rid of it.

The error I was receiving occurred while I tried to perform a rake db:migrate.  I received the error “cannot load file — sqlite3/sqlite3_native”.

After finally clearing out the sqlite3 gem, I made sure I was logged in as myself and re-installed the gem.  After re-installing the gem as myself, the GEM_HOME environment variable was updated correctly and “rake db:migrate” created my development database!

Comments

comments

This entry was posted in Rails, Technology and tagged , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *