Sha256: 34c808fef959f701eb16146161c6895839dc7d35955613480001f155864a1547
Contents?: true
Size: 385 Bytes
Versions: 1
Compression:
Stored size: 385 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.find_or_create(:title => "Main") if sections.empty? end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
datamapper-0.2.4 | spec/models/project.rb |