Hi, I'm new to sequel (and ActiveRecord, too).

I have a User class, when saving, validates some columns.

here's my code



# -*- encoding: binary -*-

require 'rubygems'
require 'bundler'

Bundler.require(:default, :development)

DB = Sequel.connect("sqlite:///tmp/a.db")

# DB.create_table(:users) do
#   primary_key :id
#   String :username, :null => false
#   String :email, :null => false
#   String :password_hash, :null => false
#   String :salt, :null => false
# end

class User < Sequel::Model
  plugin :validation_helpers

  # attr_accessible :password, :password_confirmation
  set_allowed_columns :password, :password_confirmation
  attr_accessor :password, :password_confirmation

  def validate
    super
    validates_confirmation_of :password
  end

end

u = User.new
u.username = 'foobar'
u.email = '[email protected]'
u.password = 'pass'
u.password_confirmation = 'pass'
u.save



Sequel has no attr_accessible method, so I tried using
set_allowed_columns. But I've got

undefined method `validates_confirmation_of' for #<User
@values={:username=>"foobar", :email=>"[email protected]"}>

Anyone could show me an example using this method and help me out ?

Thanks.

-- 
Silence is golden.

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to