2009-08-19 06:57:50 -04:00
|
|
|
# used to test validations
|
|
|
|
class Project < ActiveResource::Base
|
|
|
|
self.site = "http://37s.sunrise.i:3000"
|
2011-02-13 19:32:27 -05:00
|
|
|
schema do
|
|
|
|
string :email
|
|
|
|
string :name
|
|
|
|
end
|
2009-08-19 06:57:50 -04:00
|
|
|
|
2011-02-13 19:32:27 -05:00
|
|
|
validates :name, :presence => true
|
|
|
|
validates :description, :presence => false, :length => {:maximum => 10}
|
2009-08-19 06:57:50 -04:00
|
|
|
validate :description_greater_than_three_letters
|
|
|
|
|
|
|
|
# to test the validate *callback* works
|
|
|
|
def description_greater_than_three_letters
|
|
|
|
errors.add :description, 'must be greater than three letters long' if description.length < 3 unless description.blank?
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|