Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 30 lines (24 sloc) 0.73 kb
af3720b Copied models, controllers, views, helpers and specs from old backlog…
John Cinnamond authored
1 class Project < ActiveRecord::Base
2 attr_protected :organisation_id
3
bbbaf95 limit number of projects for an organisation
Andrew Bruce authored
4 validates_presence_of :name, :organisation_id
ca3ae31 WIP: migrating to multiple organisaitons - controller spec democking.
John Cinnamond authored
5
af3720b Copied models, controllers, views, helpers and specs from old backlog…
John Cinnamond authored
6 belongs_to :organisation
7 has_many :iterations, :dependent => :destroy
8 has_many :stories, :dependent => :destroy
a82bfe6 fixed iteration planning logic and moved it to Iteration model
Andrew Bruce authored
9 has_many(:available_stories,
10 :class_name => 'Story',
11 :conditions => 'iteration_id IS NULL')
af3720b Copied models, controllers, views, helpers and specs from old backlog…
John Cinnamond authored
12
bbbaf95 limit number of projects for an organisation
Andrew Bruce authored
13 def validate
14 if (organisation &&
15 organisation.projects.count >= organisation.payment_plan.project_limit)
16 errors.add(:organisation, "project limit reached")
17 end
18 end
19
af3720b Copied models, controllers, views, helpers and specs from old backlog…
John Cinnamond authored
20 def to_s
21 name || "New Project"
22 end
b40c131 prioritisation working with/without javascript
Andrew Bruce authored
23
24 def priorities=(priorities)
25 priorities.each_pair do |id, priority|
26 stories.update(id, :priority => priority)
27 end
28 end
af3720b Copied models, controllers, views, helpers and specs from old backlog…
John Cinnamond authored
29 end
Something went wrong with that request. Please try again.