activemodel 3.2.0.rc2 → 3.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,9 +1,7 @@
1
- ## Rails 3.2.0 (unreleased) ##
1
+ ## Rails 3.2.0 (January 20, 2012) ##
2
2
 
3
3
  * Deprecated `define_attr_method` in `ActiveModel::AttributeMethods`, because this only existed to
4
- support methods like `set_table_name` in Active Record, which are themselves being deprecated.
5
-
6
- *Jon Leighton*
4
+ support methods like `set_table_name` in Active Record, which are themselves being deprecated. *Jon Leighton*
7
5
 
8
6
  * Add ActiveModel::Errors#added? to check if a specific error has been added *Martin Svalin*
9
7
 
@@ -434,7 +434,7 @@ module ActiveModel
434
434
 
435
435
  protected
436
436
  def attribute_method?(attr_name)
437
- attributes.include?(attr_name)
437
+ respond_to_without_attributes?(:attributes) && attributes.include?(attr_name)
438
438
  end
439
439
 
440
440
  private
@@ -79,6 +79,19 @@ module ActiveModel
79
79
  @messages = ActiveSupport::OrderedHash.new
80
80
  end
81
81
 
82
+ def initialize_dup(other)
83
+ @messages = other.messages.dup
84
+ end
85
+
86
+ # Backport dup from 1.9 so that #initialize_dup gets called
87
+ unless Object.respond_to?(:initialize_dup)
88
+ def dup # :nodoc:
89
+ copy = super
90
+ copy.initialize_dup(self)
91
+ copy
92
+ end
93
+ end
94
+
82
95
  # Clear the messages
83
96
  def clear
84
97
  messages.clear
@@ -100,6 +113,11 @@ module ActiveModel
100
113
  messages[key] = value
101
114
  end
102
115
 
116
+ # Delete messages for +key+
117
+ def delete(key)
118
+ messages.delete(key)
119
+ end
120
+
103
121
  # When passed a symbol or a name of a method, returns an array of errors
104
122
  # for the method.
105
123
  #
@@ -114,7 +132,7 @@ module ActiveModel
114
132
  # p.errors[:name] = "must be set"
115
133
  # p.errors[:name] # => ['must be set']
116
134
  def []=(attribute, error)
117
- self[attribute.to_sym] << error
135
+ self[attribute] << error
118
136
  end
119
137
 
120
138
  # Iterates through each error key, value pair in the error messages hash.
@@ -3,7 +3,7 @@ module ActiveModel
3
3
  MAJOR = 3
4
4
  MINOR = 2
5
5
  TINY = 0
6
- PRE = "rc2"
6
+ PRE = nil
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
9
9
  end
metadata CHANGED
@@ -1,66 +1,46 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: activemodel
3
- version: !ruby/object:Gem::Version
4
- hash: 977940591
5
- prerelease: true
6
- segments:
7
- - 3
8
- - 2
9
- - 0
10
- - rc2
11
- version: 3.2.0.rc2
3
+ version: !ruby/object:Gem::Version
4
+ version: 3.2.0
5
+ prerelease:
12
6
  platform: ruby
13
- authors:
7
+ authors:
14
8
  - David Heinemeier Hansson
15
9
  autorequire:
16
10
  bindir: bin
17
11
  cert_chain: []
18
-
19
- date: 2012-01-04 00:00:00 -02:00
20
- default_executable:
21
- dependencies:
22
- - !ruby/object:Gem::Dependency
12
+ date: 2012-01-20 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
23
15
  name: activesupport
24
- prerelease: false
25
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &70352584852880 !ruby/object:Gem::Requirement
26
17
  none: false
27
- requirements:
28
- - - "="
29
- - !ruby/object:Gem::Version
30
- hash: 977940591
31
- segments:
32
- - 3
33
- - 2
34
- - 0
35
- - rc2
36
- version: 3.2.0.rc2
18
+ requirements:
19
+ - - =
20
+ - !ruby/object:Gem::Version
21
+ version: 3.2.0
37
22
  type: :runtime
38
- version_requirements: *id001
39
- - !ruby/object:Gem::Dependency
40
- name: builder
41
23
  prerelease: false
42
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: *70352584852880
25
+ - !ruby/object:Gem::Dependency
26
+ name: builder
27
+ requirement: &70352584852420 !ruby/object:Gem::Requirement
43
28
  none: false
44
- requirements:
29
+ requirements:
45
30
  - - ~>
46
- - !ruby/object:Gem::Version
47
- hash: 7
48
- segments:
49
- - 3
50
- - 0
51
- - 0
31
+ - !ruby/object:Gem::Version
52
32
  version: 3.0.0
53
33
  type: :runtime
54
- version_requirements: *id002
55
- description: A toolkit for building modeling frameworks like Active Record and Active Resource. Rich support for attributes, callbacks, validations, observers, serialization, internationalization, and testing.
34
+ prerelease: false
35
+ version_requirements: *70352584852420
36
+ description: A toolkit for building modeling frameworks like Active Record and Active
37
+ Resource. Rich support for attributes, callbacks, validations, observers, serialization,
38
+ internationalization, and testing.
56
39
  email: david@loudthinking.com
57
40
  executables: []
58
-
59
41
  extensions: []
60
-
61
42
  extra_rdoc_files: []
62
-
63
- files:
43
+ files:
64
44
  - CHANGELOG.md
65
45
  - MIT-LICENSE
66
46
  - README.rdoc
@@ -99,43 +79,28 @@ files:
99
79
  - lib/active_model/validator.rb
100
80
  - lib/active_model/version.rb
101
81
  - lib/active_model.rb
102
- has_rdoc: true
103
82
  homepage: http://www.rubyonrails.org
104
83
  licenses: []
105
-
106
84
  post_install_message:
107
85
  rdoc_options: []
108
-
109
- require_paths:
86
+ require_paths:
110
87
  - lib
111
- required_ruby_version: !ruby/object:Gem::Requirement
88
+ required_ruby_version: !ruby/object:Gem::Requirement
112
89
  none: false
113
- requirements:
114
- - - ">="
115
- - !ruby/object:Gem::Version
116
- hash: 57
117
- segments:
118
- - 1
119
- - 8
120
- - 7
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
121
93
  version: 1.8.7
122
- required_rubygems_version: !ruby/object:Gem::Requirement
94
+ required_rubygems_version: !ruby/object:Gem::Requirement
123
95
  none: false
124
- requirements:
125
- - - ">"
126
- - !ruby/object:Gem::Version
127
- hash: 25
128
- segments:
129
- - 1
130
- - 3
131
- - 1
132
- version: 1.3.1
96
+ requirements:
97
+ - - ! '>='
98
+ - !ruby/object:Gem::Version
99
+ version: '0'
133
100
  requirements: []
134
-
135
101
  rubyforge_project:
136
- rubygems_version: 1.3.7
102
+ rubygems_version: 1.8.10
137
103
  signing_key:
138
104
  specification_version: 3
139
105
  summary: A toolkit for building modeling frameworks (part of Rails).
140
106
  test_files: []
141
-