lists 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -29,5 +29,11 @@ module Lists
29
29
  @list.update_attributes(params[:list])
30
30
  respond_with @list
31
31
  end
32
+
33
+ def destroy
34
+ @list = List.find(params[:id])
35
+ @list.destroy
36
+ respond_with @list
37
+ end
32
38
  end
33
39
  end
@@ -1,10 +1,14 @@
1
1
  module Lists
2
2
  class List < ActiveRecord::Base
3
- has_many :list_items
3
+ has_many :list_items, order: :position
4
4
  belongs_to :listable, polymorphic: true
5
5
 
6
6
  attr_accessible :body, :position, :subject, :listable, :listable_type, :listable_id, :list_items_attributes
7
7
 
8
8
  accepts_nested_attributes_for :list_items, reject_if: ->(o) {o[:subject].blank? and o[:body].blank?}, allow_destroy: true
9
+
10
+ def to_s
11
+ subject
12
+ end
9
13
  end
10
14
  end
@@ -1,7 +1,13 @@
1
1
  module Lists
2
2
  class ListItem < ActiveRecord::Base
3
- belongs_to :list
3
+ acts_as_list scope: :list_id
4
+
5
+ belongs_to :list, inverse_of: :list_items
4
6
 
5
7
  attr_accessible :body, :position, :subject
8
+
9
+ def to_s
10
+ subject
11
+ end
6
12
  end
7
13
  end
@@ -1,5 +1,6 @@
1
1
  require "lists/engine"
2
2
  require 'haml'
3
+ require 'acts_as_list'
3
4
 
4
5
  module Lists
5
6
  end
@@ -1,3 +1,3 @@
1
1
  module Lists
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lists
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-04 00:00:00.000000000 Z
12
+ date: 2012-06-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -43,6 +43,22 @@ dependencies:
43
43
  - - ! '>='
44
44
  - !ruby/object:Gem::Version
45
45
  version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: acts_as_list
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
46
62
  - !ruby/object:Gem::Dependency
47
63
  name: sqlite3
48
64
  requirement: !ruby/object:Gem::Requirement
@@ -136,7 +152,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
136
152
  version: '0'
137
153
  segments:
138
154
  - 0
139
- hash: -2051522105190068898
155
+ hash: 2723496742218291152
140
156
  required_rubygems_version: !ruby/object:Gem::Requirement
141
157
  none: false
142
158
  requirements:
@@ -145,7 +161,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
145
161
  version: '0'
146
162
  segments:
147
163
  - 0
148
- hash: -2051522105190068898
164
+ hash: 2723496742218291152
149
165
  requirements: []
150
166
  rubyforge_project:
151
167
  rubygems_version: 1.8.24