Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6846633
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:38:51+00:00 2026-05-27T00:38:51+00:00

I have just deployed my app to heroku, and after some problems, it seem

  • 0

I have just deployed my app to heroku, and after some problems, it seem to work.
But then i try to add a record to an sqlite3 database from the app, it’s not working, and isn’t redirecting me to ‘/’.

It’s a sinatra app, i have installed all the data mapper dependencies, and the logs doesn’t repost errors.
here is the code

require 'rubygems'
require 'sinatra'
require 'dm-core'  
require 'dm-timestamps'  
require 'dm-validations'  
require 'dm-migrations'
DataMapper::setup(:default, "sqlite3://#{Dir.pwd}/rubrica.db")

class Contatto  
  include DataMapper::Resource  
  property :id, Serial  
  property :fname, Text
  property :lname, Text
  property :phone, Text  
  property :mail, Text
end  

DataMapper.finalize.auto_upgrade!  

get '/' do
    @title = 'Tutti'
  @Contatti = Contatto.all
    erb :home
end

get '/add' do
    @title = 'Aggiungi'
    erb :aggiungi
end

post '/' do
    c = Contatto.new
    c.fname = params[:fname]
c.lname = params[:lname]
c.phone = params[:phone]
c.mail = params[:mail]
c.save
redirect '/'

end

and the link
here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T00:38:51+00:00Added an answer on May 27, 2026 at 12:38 am

    The problem is that Heroku doesn’t use sqlite. If you specify sqlite as your database of choice, Heroku will do some black magic when it receives the push, and replace the sqlite3 gem with the postgres gem, and then run your application with a postgres database. So that explains why your DataMapper::setup(:default, "sqlite3://#{Dir.pwd}/rubrica.db") call isn’t working.

    Read this Heroku doc for more information.

    Upon some further reading of the Heroku docs, it appears that you need to change your call to Datamapper to be as such:

    DataMapper.setup(:default, ENV['DATABASE_URL'] || 'sqlite3://#{Dir.pwd}/rubrica.db')
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I created an app and deployed it to Heroku, but I didn't have a
we have just deployed an Azure App and are getting these errors when updating
I have just deployed a new MVC3 app to my hosting provider for the
I have an app deployed on Heroku. I can access the remote heroku console
I have just deployed my app and as soon as I go on the
I have a jruby rails app and I've just started using bundler for gem
I've just deployed an ASP.NET web site to my hosting provider, but I keep
I have just deployed my first application in .NET MVC and i'm having issues.
I am just learning about app.config in respect of creating custom sections. I have
I've just deployed an app to App Engine and everything is working great. I'm

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.