1
require 'rubygems'
require 'sinatra'
require 'data_mapper'
require 'dm-paperclip'
require 'haml'
require 'fileutils'
require 'dm-migrations/adapters/dm-sqlite-adapter'
require 'data_mapper'
require 'dm-migrations'

APP_ROOT = File.expand_path(File.dirname(__FILE__))

DataMapper.setup(:default, "sqlite3://#{Dir.pwd}/macerdo.db")

class DevApp
    include DataMapper::Resource
    include Paperclip::Resource

    property :id, Serial
    property :name, String
    property :appDescription, String
    property :priceInDollars, String 
    property :priceInUGX, String
    property :created_at, DateTime

    property :file , FilePath

    DataMapper.finalize.auto_upgrade! 
end

The above is my code.I am working on a site using sinatra.I tried to save an object but it fails without any errors.I looked for help online but I did not get a solution. I will appreciate any help.

I wrote this while trying to save.

@resource = DevApp.create(:file=>params[:file],:name => params[:name], :priceInDollars => params[:priceInDollars], :priceInUGX => params[:priceInUGX], :appDescription => params[:appDescription], :created_at => DateTime.now )
Joannah Nanjekye
  • 429
  • 1
  • 5
  • 16

0 Answers0