Skip to content

Instantly share code, notes, and snippets.

@nanodeath
Created February 20, 2009 04:18
Show Gist options
  • Save nanodeath/67311 to your computer and use it in GitHub Desktop.
Save nanodeath/67311 to your computer and use it in GitHub Desktop.
/usr/local/lib/ruby/gems/1.9.1/gems/sequel-2.10.0/lib/sequel_model/record.rb:52:in `[]=': undefined method `include?' for nil:NilClass (NoMethodError)
from /usr/local/lib/ruby/gems/1.9.1/gems/sequel-2.10.0/lib/sequel_model/base.rb:445:in `block (3 levels) in def_column_accessor'
from /home/max/Projects/writetogether/model/init.rb:16:in `<top (required)>'
from start.rb:14:in `require'
from start.rb:14:in `<main>'
# Here goes your database connection and options:
require 'sequel'
begin
DB = Sequel.sqlite
rescue NoMethodError
raise LoadError, 'Install latest Sequel gem'
end
require 'model/user'
unless User.table_exists?
puts "table doesn't exist"
User.create_table
u = User.new
u.username = 'admin'
u.password = 'password'
u.save
# User.create(:username => 'admin', :password => 'password')
#User << {:username => 'admin', :password => 'password'}
# none of the above three methods work
puts "user created"
end
class User < Sequel::Model
set_schema do
primary_key :id
varchar :username
varchar :password
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment