ruby - Sqlite+ Sinatra - Database file is not getting created with DataMapper.setup -
i creating 1 web application in sinatra , sqlite. using below code create sqlite database through sinatra-
datamapper.setup(:default, "sqlite3://#{dir.pwd}/development.db")
i not getting errors while creating entry in database through web application not able find "development.db" file in current folder , it's not there in other folders.
please suggest might issue. whole code -
require 'dm-core' require 'dm-migrations' datamapper.setup(:default, "sqlite3://#{dir.pwd}/development.db") class student include datamapper::resource property :row_id, serial property :first_name, string property :last_name, string property :scu_email, string property :registered_on, date property :program_name, string property :specialization, string property :expected_grad_year, string property :courses, text property :username, string property :password, string end datamapper.finalize student.auto_migrate!
try replacing dir.pwd
__dir__
or file.expand_path(__dir__)
Comments
Post a Comment