0

Newbie question on Rails 3 development.

I am creating my first app and planning on deploying it to Heroku. Since Heroku uses PostgreSQL I thought I would change from SQLite on my development machine and move to PostgreSQL. Here is the gem file:

***source 'http://rubygems.org'

gem 'rails', '3.0.1'

gem 'pg', :require => 'pg'

gem 'devise', '1.2.0'

group :development do

gem 'rspec-rails', '2.0.1'

end

group :test do

gem 'rspec', '2.0.1'

gem 'webrat', '0.7.1'

end***

I ran a page generator but whenever I try to view the pages locally, I get the following error:

no such file to load -- sqlite3

I don't understand where this SQLite error is coming from because I commented out SQLite from the gemfile.

The bigger question is rather it is neccesary to change my database gem at all. Is it better to develop with SQLite and let the host convert the databases?

TIA

1 Answer 1

1

The problem is probably in your database.yml, I'd guess that it looks something like this:

development:
  adapter: sqlite3

but you want it to look more like this:

development:
  adapter: postgresql

You'll probably want to apply the same change to the test: and production: sections as well; Heroku won't pay attention to the adapter but consistency is a good idea.

As far as the second question goes, I think you're better off developing and deploying on identical platforms. You can usually get away with developing on OSX or Windows but deploying on Linux if you're careful but you should have the same gem versions, same Ruby version, same Rails version, same database (including the version!), etc. Anything else is going to cause you a lot of pain and suffering sooner or later. So, kudos for developing on PostgreSQL when you're deploying on Heroku, good call.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for the help. You were correct on the database.yml. Unfortunately that was the tip of the iceberg. I installed the postgresql gem after i started the aplication. Thats why the database was setup to look for sqlite. After slugging through error after error, I decide to just start over from scratch (not really that far along anyway.) In case anyone is googling and looking for info on setting up postgresql on rails 3 I am following this guide -- funonrails.com/2011/03/…. For some reason i didnt find this guide the first time

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.