Luiz wrote:
> My class:
>
> class User<  Sequel::Model(:user)
>    validates do
>        presence_of :login
>    end
> end
>
> result error: undefined method `validates'
>
> there is no more validation methods in sequel?
>
> i'm using sequel 3.5.0
>    

Take a look at the validation_helpers plugin:
     
http://sequel.rubyforge.org/rdoc-plugins/classes/Sequel/Plugins/ValidationHelpers.html
     
http://sequel.rubyforge.org/rdoc-plugins/classes/Sequel/Plugins/ValidationHelpers/InstanceMethods.html

Also look at the README.rdoc file, right at the bottom there is a small 
part on 'Model Validations'.



EXAMPLE

Sequel::Model.plugin(:validation_helpers)

class Person < Sequel::Model
     set_primary_key :id
     set_dataset :people

     # Validate model object, is called before we save.
     def validate
         validates_format RFC822::EmailAddress, :email_address
         validates_min_length 1, :first_name
         validates_min_length 1, :last_name

         if self.exists?
             validates_min_length 8, :password, :allow_blank => true
         else
             validates_min_length 8, :password
         end
     end
end

HTH

Luke

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to