Skip to content

Instantly share code, notes, and snippets.

@masaedw
Last active December 31, 2015 22:49
Show Gist options
  • Save masaedw/8056050 to your computer and use it in GitHub Desktop.
Save masaedw/8056050 to your computer and use it in GitHub Desktop.
require 'sinatra/base'
require 'sequel'
$LOAD_PATH << "."
autoload :Post, "post"
class MyApp < Sinatra::Base
configure do
DB = Sequel.connect("sqlite://sample.db")
end
end
require 'sinatra/base'
require 'sequel'
$LOAD_PATH << "."
require 'post'
class MyApp < Sinatra::Base
configure do
DB = Sequel.connect("sqlite://sample.db")
end
end
masa@vardamir> ruby app.rb
/Users/masa/.rvm/gems/ruby-2.0.0-p353/gems/sequel-4.5.0/lib/sequel/model/base.rb:226:in `db': No database associated with Sequel::Model: have you called Sequel.connect or Sequel::Model.db= ? (Sequel::Error)
from /Users/masa/.rvm/gems/ruby-2.0.0-p353/gems/sequel-4.5.0/lib/sequel/model/base.rb:371:in `inherited'
from /Users/masa/devel/hoge/post.rb:1:in `<top (required)>'
from /Users/masa/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/masa/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from app.rb:4:in `<main>'
class Post < Sequel::Model
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment