Skip to content

Instantly share code, notes, and snippets.

@ku1ik
Created April 14, 2010 18:53
Show Gist options
  • Save ku1ik/366176 to your computer and use it in GitHub Desktop.
Save ku1ik/366176 to your computer and use it in GitHub Desktop.
class Subtask
include DataMapper::Resource
include CommonProperties
property :body, String, :required => true, :length => 32, :messages => { :presence => "Subtask can't be blank" }
property :creator_id, Integer, :required => true, :index => true
property :is_checked, Boolean, :default => false
property :task_id, Integer, :required => true, :index => true
belongs_to :creator, :model => "User"
belongs_to :task
validates_length_of :body, :min => 2, :max => 32, :message => "Subtask should be at least 2 and at most 32 characters long"
is :sanitized, :body
def self.checked
all(:is_checked => true)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment