active_presenter 2.0.0a → 3.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README +2 -0
- data/lib/active_presenter/base.rb +4 -4
- data/lib/active_presenter/version.rb +4 -5
- data/test/test_helper.rb +5 -0
- metadata +22 -47
data/README
CHANGED
@@ -91,6 +91,8 @@ Note that if any of your after_save callbacks return false, the rest of them wil
|
|
91
91
|
|
92
92
|
ActivePresenter was created, and is maintained by {Daniel Haran}[http://danielharan.com] and {James Golick}[http://jamesgolick.com] on the train ride to {RubyFringe}[http://rubyfringe.com] from Montreal.
|
93
93
|
|
94
|
+
ActivePresenter for Rails 3 is currently maintained by {Josh Martin}[http://github.com/skiz] and {Johnno Loggie}[http://github.com/johnno]
|
95
|
+
|
94
96
|
== License
|
95
97
|
|
96
98
|
ActivePresenter is available under the {MIT License}[http://en.wikipedia.org/wiki/MIT_License]
|
@@ -12,7 +12,7 @@ module ActivePresenter
|
|
12
12
|
|
13
13
|
define_model_callbacks :validation, :save
|
14
14
|
|
15
|
-
|
15
|
+
class_attribute :presented
|
16
16
|
self.presented = {}
|
17
17
|
|
18
18
|
# Indicates which models are to be presented by this presenter.
|
@@ -39,7 +39,8 @@ module ActivePresenter
|
|
39
39
|
send(t).errors
|
40
40
|
end
|
41
41
|
|
42
|
-
|
42
|
+
# We must reassign in derrived classes rather than mutating the attribute in Base
|
43
|
+
self.presented = self.presented.merge(t => types_and_classes[t])
|
43
44
|
end
|
44
45
|
end
|
45
46
|
|
@@ -217,7 +218,7 @@ module ActivePresenter
|
|
217
218
|
def id # :nodoc:
|
218
219
|
nil
|
219
220
|
end
|
220
|
-
|
221
|
+
|
221
222
|
def new_record?
|
222
223
|
presented_instances.map(&:new_record?).all?
|
223
224
|
end
|
@@ -272,6 +273,5 @@ module ActivePresenter
|
|
272
273
|
flat_attribute = {flatten_attribute_name(name, presentable) => ''} #remove_att... normally takes a hash, so we use a ''
|
273
274
|
presented[presentable].new.send(:sanitize_for_mass_assignment, flat_attribute).empty?
|
274
275
|
end
|
275
|
-
|
276
276
|
end
|
277
277
|
end
|
data/test/test_helper.rb
CHANGED
@@ -84,6 +84,11 @@ class EndingWithSPresenter < ActivePresenter::Base
|
|
84
84
|
presents :address
|
85
85
|
end
|
86
86
|
|
87
|
+
class HistoricalPresenter < ActivePresenter::Base
|
88
|
+
presents :user, :history
|
89
|
+
attr_accessible :history_comment
|
90
|
+
end
|
91
|
+
|
87
92
|
class CantSavePresenter < ActivePresenter::Base
|
88
93
|
presents :address
|
89
94
|
|
metadata
CHANGED
@@ -1,34 +1,23 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_presenter
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 2
|
8
|
-
- 0
|
9
|
-
- 0
|
10
|
-
- a
|
11
|
-
version: 2.0.0a
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 3.2.2
|
5
|
+
prerelease:
|
12
6
|
platform: ruby
|
13
|
-
authors:
|
7
|
+
authors:
|
14
8
|
- James Golick & Daniel Haran
|
15
9
|
autorequire:
|
16
10
|
bindir: bin
|
17
11
|
cert_chain: []
|
18
|
-
|
19
|
-
date: 2011-09-26 00:00:00 -07:00
|
20
|
-
default_executable:
|
12
|
+
date: 2012-08-27 00:00:00.000000000 Z
|
21
13
|
dependencies: []
|
22
|
-
|
23
|
-
|
14
|
+
description: ActivePresenter is the presenter library you already know! (...if you
|
15
|
+
know ActiveRecord)
|
24
16
|
email: james@giraffesoft.ca
|
25
17
|
executables: []
|
26
|
-
|
27
18
|
extensions: []
|
28
|
-
|
29
19
|
extra_rdoc_files: []
|
30
|
-
|
31
|
-
files:
|
20
|
+
files:
|
32
21
|
- README
|
33
22
|
- LICENSE
|
34
23
|
- Rakefile
|
@@ -40,43 +29,29 @@ files:
|
|
40
29
|
- test/base_test.rb
|
41
30
|
- test/lint_test.rb
|
42
31
|
- test/test_helper.rb
|
43
|
-
has_rdoc: true
|
44
32
|
homepage: http://jamesgolick.com/active_presenter
|
45
33
|
licenses: []
|
46
|
-
|
47
34
|
post_install_message:
|
48
35
|
rdoc_options: []
|
49
|
-
|
50
|
-
require_paths:
|
36
|
+
require_paths:
|
51
37
|
- lib
|
52
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
38
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
53
39
|
none: false
|
54
|
-
requirements:
|
55
|
-
- -
|
56
|
-
- !ruby/object:Gem::Version
|
57
|
-
hash: 61
|
58
|
-
segments:
|
59
|
-
- 1
|
60
|
-
- 8
|
61
|
-
- 5
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
62
43
|
version: 1.8.5
|
63
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
44
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
64
45
|
none: false
|
65
|
-
requirements:
|
66
|
-
- -
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
|
69
|
-
segments:
|
70
|
-
- 1
|
71
|
-
- 3
|
72
|
-
- 1
|
73
|
-
version: 1.3.1
|
46
|
+
requirements:
|
47
|
+
- - ! '>='
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '0'
|
74
50
|
requirements: []
|
75
|
-
|
76
51
|
rubyforge_project: active_presenter
|
77
|
-
rubygems_version: 1.
|
52
|
+
rubygems_version: 1.8.10
|
78
53
|
signing_key:
|
79
54
|
specification_version: 3
|
80
|
-
summary: ActivePresenter is the presenter library you already know! (...if you know
|
55
|
+
summary: ActivePresenter is the presenter library you already know! (...if you know
|
56
|
+
ActiveRecord)
|
81
57
|
test_files: []
|
82
|
-
|