Sha256: dae10d79124529a1ff93d75904fbd3333f244bb46869a1a8974d5e840b33338a
Contents?: true
Size: 374 Bytes
Versions: 4
Compression:
Stored size: 374 Bytes
Contents
class Project < DataMapper::Base property :title, :string property :description, :string has_many :sections before_create :create_main_section def tickets return [] if sections.empty? sections.map { |section| section.tickets } end private def create_main_section sections << Section.new(:title => "Main") if sections.empty? end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
datamapper-0.2.0 | spec/models/project.rb |
datamapper-0.2.1 | spec/models/project.rb |
datamapper-0.2.2 | spec/models/project.rb |
datamapper-0.2.3 | spec/models/project.rb |