forked from bryanlarsen/agility-gitorial-patches
-
Notifications
You must be signed in to change notification settings - Fork 1
/
38-acts-as-list-model-changes.patch
39 lines (30 loc) · 1.16 KB
/
38-acts-as-list-model-changes.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
acts-as-list-model-changes
From: Bryan Larsen <[email protected]>
Now two changes to our models:
SHOW_PATCH
---
app/models/story.rb | 3 +--
app/models/task.rb | 2 ++
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/app/models/story.rb b/app/models/story.rb
index e2d0489..0f54a82 100644
--- a/app/models/story.rb
+++ b/app/models/story.rb
@@ -12,8 +12,7 @@ class Story < ActiveRecord::Base
belongs_to :project, :inverse_of => :stories, :counter_cache => true
belongs_to :status, :class_name => "StoryStatus", :inverse_of => :stories
-
- has_many :tasks, :dependent => :destroy, :inverse_of => :story
+ has_many :tasks, :dependent => :destroy, :inverse_of => :story, :order => :position
children :tasks
diff --git a/app/models/task.rb b/app/models/task.rb
index dced8e0..1516794 100644
--- a/app/models/task.rb
+++ b/app/models/task.rb
@@ -13,6 +13,8 @@ class Task < ActiveRecord::Base
has_many :task_assignments, :dependent => :destroy, :inverse_of => :task
has_many :users, :through => :task_assignments, :accessible => true, :dependent => :destroy
+ acts_as_list :scope => :story
+
# --- Permissions --- #
def create_permitted?