Can any one volunteer why the class below fails?
... src/model/user.rb:18: undefined method `set_schema' for User:Class (NoMethodError)
I've looked in the Sequel-3.0 lib/ folder and the set_schema
method is defined in a ClassMethods
module.
I'm sure the solution is simple. I was thinking it should work "as is":
require 'sequel'
class User < Sequel::Model(:user)
set_schema do
set_primary_key :id
String :name
end
end
Recommended way ...
LOGGER = Object.new()
def LOGGER.method_missing( name, args )
puts "[#{name}] #{args}"
end
Sequel::Model.plugin(:schema) # I worked this out, but I can't find it documented
DB = Sequel.sqlite('sql_test.db', :loggers => [LOGGER] )
unless DB.table_exists?( :user )
DB.create_table :user do
set_primary_key :id
String :name
String :password
String :eMail
end #create_table
end #table exists
class User < Sequel::Model(:user)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With