Hi there You can't use sqlite on Heroku because our file system is read-only for scalability reasons. Instead, use the provided PostgreSQL database. Here's a useful example, of how to get the db connection params and connect to Postgres: http://gist.github.com/68277
Morten On Feb 23, 2009, at 1:22 AM, IndianGuru wrote: > > I am new to Sinatra and Heroku. > > I have deployed a simple Sinatra app (works locally) that uses > ActiveRecord and SQLite3 at - > http://evening-ocean-74.heroku.com/ > > However, it gives an error: could not open database: unable to open > database file (SQLite3::CantOpenException) > > The code is - > # crud.rb > require 'sinatra' > require 'active_record' > > configure :production do > # connect to the database (sqlite3 in this case) > ActiveRecord::Base.establish_connection( > :adapter=> "sqlite3", > :database=> "participant" ) > > begin > ActiveRecord::Schema.define do > create_table :students do |t| > t.string :name, :null => false, :limit => 100 > t.string :email, :null => false, :limit => 50 > end > end > rescue ActiveRecord::StatementInvalid > # do nothing - gobble up the error > end > end > > # define a simple model > class Student < ActiveRecord::Base > end > > get '/' do > @students = Student.all() > erb :index > end > > get '/student/:id' do > @student = Student.find(params[:id]) > if @student > erb :show > else > redirect '/' > end > end > > What am I doing wrong? All help appreciated. > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Heroku" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/heroku?hl=en -~----------~----~----~----~------~----~------~--~---
