Created
February 20, 2009 04:18
-
-
Save nanodeath/67311 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/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>' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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