Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 217 lines (138 sloc) 6.318 kB
375d9a0 @dhh Prepare for release
dhh authored
1 ## Rails 4.0.0 (June 25, 2013) ##
b965ce3 @pnc Fix regression in has_secure_password.
pnc authored
2
3 * Fix regression in has_secure_password. When a password is set, but a
4 confirmation is an empty string, it would incorrectly save.
5
6 *Steve Klabnik* and *Phillip Calvin*
7
3d0c0c6 @carlosantoniodasilva Improve changelog entry for ActiveModel::Errors#full_messages_for [ci…
carlosantoniodasilva authored
8 * Add `ActiveModel::Errors#full_messages_for`, to return all the error messages
9 for a given attribute.
10
c245437 @senny use unified and clean formatting in CHANGELOGS. [ci skip]
senny authored
11 Example:
12
3d0c0c6 @carlosantoniodasilva Improve changelog entry for ActiveModel::Errors#full_messages_for [ci…
carlosantoniodasilva authored
13 class Person
14 include ActiveModel::Validations
15
16 attr_reader :name, :email
17 validates_presence_of :name, :email
18 end
19
20 person = Person.new
21 person.valid? # => false
22 person.errors.full_messages_for(:name) # => ["Name can't be blank"]
ec1b715 @shockone Add a method full_messages_for to the Errors class
shockone authored
23
24 *Volodymyr Shatsky*
25
3ee30ca @wangjohn The repair_validations helper was not working correctly before because
wangjohn authored
26 * Added a method so that validations can be easily cleared on a model.
27 For example:
28
c245437 @senny use unified and clean formatting in CHANGELOGS. [ci skip]
senny authored
29 class Person
30 include ActiveModel::Validations
3ee30ca @wangjohn The repair_validations helper was not working correctly before because
wangjohn authored
31
c245437 @senny use unified and clean formatting in CHANGELOGS. [ci skip]
senny authored
32 validates_uniqueness_of :first_name
33 validate :cannot_be_robot
3ee30ca @wangjohn The repair_validations helper was not working correctly before because
wangjohn authored
34
c245437 @senny use unified and clean formatting in CHANGELOGS. [ci skip]
senny authored
35 def cannot_be_robot
36 errors.add(:base, 'A person cannot be a robot') if person_is_robot
37 end
3ee30ca @wangjohn The repair_validations helper was not working correctly before because
wangjohn authored
38 end
39
40 Now, if someone runs `Person.clear_validators!`, then the following occurs:
41
c245437 @senny use unified and clean formatting in CHANGELOGS. [ci skip]
senny authored
42 Person.validators # => []
43 Person._validate_callbacks.empty? # => true
3ee30ca @wangjohn The repair_validations helper was not working correctly before because
wangjohn authored
44
45 *John Wang*
46
8c1687b @senny `has_secure_password` is not invalid when assigning empty Strings.
senny authored
47 * `has_secure_password` does not fail the confirmation validation
48 when assigning empty String to `password` and `password_confirmation`.
c245437 @senny use unified and clean formatting in CHANGELOGS. [ci skip]
senny authored
49 Fixes #9535.
8c1687b @senny `has_secure_password` is not invalid when assigning empty Strings.
senny authored
50
51 Example:
52
b3a31e9 @carlosantoniodasilva Fix AMo code example indent, add missing author to entry [ci skip]
carlosantoniodasilva authored
53 # Given User has_secure_password.
8c1687b @senny `has_secure_password` is not invalid when assigning empty Strings.
senny authored
54 @user.password = ""
55 @user.password_confirmation = ""
56 @user.valid?(:update) # used to be false
57
b3a31e9 @carlosantoniodasilva Fix AMo code example indent, add missing author to entry [ci skip]
carlosantoniodasilva authored
58 *Yves Senn*
59
b501ee4 @senny `validates_confirmation_of` does not override writer methods.
senny authored
60 * `validates_confirmation_of` does not override writer methods for
61 the confirmation attribute if no reader is defined.
62
63 Example:
64
65 class Blog
b3a31e9 @carlosantoniodasilva Fix AMo code example indent, add missing author to entry [ci skip]
carlosantoniodasilva authored
66 def title=(new_title)
67 @title = new_title.downcase
68 end
b501ee4 @senny `validates_confirmation_of` does not override writer methods.
senny authored
69
b3a31e9 @carlosantoniodasilva Fix AMo code example indent, add missing author to entry [ci skip]
carlosantoniodasilva authored
70 # previously this would override the setter above.
71 validates_confirmation_of :title
b501ee4 @senny `validates_confirmation_of` does not override writer methods.
senny authored
72 end
73
74 *Yves Senn*
0f75e2c @rafaelfranca Update CHANGELOGS
rafaelfranca authored
75
d72a07f @robotex82 Add `ActiveModel::Validations::AbsenceValidator`, a validator to chec…
robotex82 authored
76 * Add `ActiveModel::Validations::AbsenceValidator`, a validator to check the
77 absence of attributes.
78
05b80a1 @carlosantoniodasilva Improve AMo changelog example to not rely on AR [ci skip]
carlosantoniodasilva authored
79 class Person
80 include ActiveModel::Validations
81
82 attr_accessor :first_name
d72a07f @robotex82 Add `ActiveModel::Validations::AbsenceValidator`, a validator to chec…
robotex82 authored
83 validates_absence_of :first_name
84 end
85
86 person = Person.new
87 person.first_name = "John"
88 person.valid?
05b80a1 @carlosantoniodasilva Improve AMo changelog example to not rely on AR [ci skip]
carlosantoniodasilva authored
89 # => false
90 person.errors.messages
91 # => {:first_name=>["must be blank"]}
d72a07f @robotex82 Add `ActiveModel::Validations::AbsenceValidator`, a validator to chec…
robotex82 authored
92
05b80a1 @carlosantoniodasilva Improve AMo changelog example to not rely on AR [ci skip]
carlosantoniodasilva authored
93 *Roberto Vasquez Angel*
d72a07f @robotex82 Add `ActiveModel::Validations::AbsenceValidator`, a validator to chec…
robotex82 authored
94
05857ec @fxn did a pass over the AM changelog [ci skip]
fxn authored
95 * `[attribute]_changed?` now returns `false` after a call to `reset_[attribute]!`.
cf7ab60 @rmascarenhas Reset attributes should not report changes.
rmascarenhas authored
96
97 *Renato Mascarenhas*
98
ec17f0d @rafaelfranca Add CHANGELOG entries for the observes extraction
rafaelfranca authored
99 * Observers was extracted from Active Model as `rails-observers` gem.
100
101 *Rafael Mendonça França*
102
05857ec @fxn did a pass over the AM changelog [ci skip]
fxn authored
103 * Specify type of singular association during serialization.
9504b44 @steveklabnik Specify type of singular association during serialization
steveklabnik authored
104
05857ec @fxn did a pass over the AM changelog [ci skip]
fxn authored
105 *Steve Klabnik*
106
107 * Fixed length validator to correctly handle `nil`. Fixes #7180.
ea76e9a @xHire Length validation handles correctly nil. Fix #7180
xHire authored
108
109 *Michal Zima*
110
22598ee @senny cleanup, removed dispensable `require` statements from `ActiveModel`
senny authored
111 * Removed dispensable `require` statements. Make sure to require `active_model` before requiring
112 individual parts of the framework.
113
114 *Yves Senn*
115
5f59317 @prathamesh-sonpatki Fixed typo in activemodel/CHANGELOG
prathamesh-sonpatki authored
116 * Use BCrypt's `MIN_COST` in the test environment for speedier tests when using `has_secure_password`.
06faa6d @trevorturk Use BCrypt's MIN_COST in the test environment for speedier tests
trevorturk authored
117
118 *Brian Cardarella + Jeremy Kemper + Trevor Turk*
119
1f4c89f @guilleiguaran Update changelogs to add entries about strong_parameters integration
guilleiguaran authored
120 * Add `ActiveModel::ForbiddenAttributesProtection`, a simple module to
121 protect attributes from mass assignment when non-permitted attributes are passed.
122
123 *DHH + Guillermo Iguaran*
124
125 * `ActiveModel::MassAssignmentSecurity` has been extracted from Active Model and the
126 `protected_attributes` gem should be added to Gemfile in order to use
127 `attr_accessible` and `attr_protected` macros in your models.
128
129 *Guillermo Iguaran*
130
05857ec @fxn did a pass over the AM changelog [ci skip]
fxn authored
131 * Due to a change in builder, `nil` and empty strings now generate
0180e09 @carlosantoniodasilva Update Active Model xml serialization test to reflect a change in bui…
carlosantoniodasilva authored
132 closed tags, so instead of this:
133
134 <pseudonyms nil=\"true\"></pseudonyms>
135
05857ec @fxn did a pass over the AM changelog [ci skip]
fxn authored
136 it generates this:
0180e09 @carlosantoniodasilva Update Active Model xml serialization test to reflect a change in bui…
carlosantoniodasilva authored
137
138 <pseudonyms nil=\"true\"/>
139
140 *Carlos Antonio da Silva*
141
05857ec @fxn did a pass over the AM changelog [ci skip]
fxn authored
142 * Inclusion/exclusion validators accept a method name passed as a symbol to the
143 `:in` option.
2f3eb48 @sobrinho Accept a symbol for `:in` option on inclusion and exclusion validators
sobrinho authored
144
05857ec @fxn did a pass over the AM changelog [ci skip]
fxn authored
145 This allows to use dynamic inclusion/exclusion values using methods, besides
146 the current lambda/proc support.
2f3eb48 @sobrinho Accept a symbol for `:in` option on inclusion and exclusion validators
sobrinho authored
147
148 *Gabriel Sobrinho*
149
05857ec @fxn did a pass over the AM changelog [ci skip]
fxn authored
150 * `ActiveModel::Validation#validates` ability to pass custom exception to the
151 `:strict` option.
cfd7f4e @rafaelfranca Merge pull request #7024 from bogdan/strict_validation_custom_exception
rafaelfranca authored
152
153 *Bogdan Gusiev*
154
155 * Changed `ActiveModel::Serializers::Xml::Serializer#add_associations` to by default
156 propagate `:skip_types, :dasherize, :camelize` keys to included associations.
29dcf09 @vipulnsward Small typos here and there.
vipulnsward authored
157 It can be overridden on each association by explicitly specifying the option on one
cfd7f4e @rafaelfranca Merge pull request #7024 from bogdan/strict_validation_custom_exception
rafaelfranca authored
158 or more associations
159
160 *Anthony Alberto*
78f5874 @anthonyalberto Following the false issue reporting I did here : https://github.com/r…
anthonyalberto authored
161
05857ec @fxn did a pass over the AM changelog [ci skip]
fxn authored
162 * Changed `ActiveModel::Serializers::JSON.include_root_in_json` default value to false.
ab11a27 change AMS::JSON.include_root_in_json default value to false
Francesco Rodriguez authored
163 Now, AM Serializers and AR objects have the same default behaviour. Fixes #6578.
164
165 class User < ActiveRecord::Base; end
166
167 class Person
168 include ActiveModel::Model
169 include ActiveModel::AttributeMethods
170 include ActiveModel::Serializers::JSON
171
172 attr_accessor :name, :age
173
174 def attributes
175 instance_values
176 end
177 end
178
179 user.as_json
180 => {"id"=>1, "name"=>"Konata Izumi", "age"=>16, "awesome"=>true}
181 # root is not included
182
183 person.as_json
184 => {"name"=>"Francesco", "age"=>22}
185 # root is not included
186
187 *Francesco Rodriguez*
188
05857ec @fxn did a pass over the AM changelog [ci skip]
fxn authored
189 * Passing false hash values to `validates` will no longer enable the corresponding validators.
190
191 *Steve Purcell*
192
193 * `ConfirmationValidator` error messages will attach to `:#{attribute}_confirmation` instead of `attribute`.
194
195 *Brian Cardarella*
196
197 * Added `ActiveModel::Model`, a mixin to make Ruby objects work with AP out of box.
b3ccd7b @purcell Don't enable validations when passing false hash values to ActiveMode…
purcell authored
198
05857ec @fxn did a pass over the AM changelog [ci skip]
fxn authored
199 *Guillermo Iguaran*
200
201 * `AM::Errors#to_json`: support `:full_messages` parameter.
202
203 *Bogdan Gusiev*
3a749a9 @bcardarella Reordered changelog entry
bcardarella authored
204
05857ec @fxn did a pass over the AM changelog [ci skip]
fxn authored
205 * Trim down Active Model API by removing `valid?` and `errors.full_messages`.
3b822e9 @guilleiguaran Add ActiveModel::Model, a mixin to make Ruby objects to work with AP …
guilleiguaran authored
206
05857ec @fxn did a pass over the AM changelog [ci skip]
fxn authored
207 *José Valim*
534dc4c @bogdan AM::Errors: allow :full_messages parameter for #as_json
bogdan authored
208
05857ec @fxn did a pass over the AM changelog [ci skip]
fxn authored
209 * When `^` or `$` are used in the regular expression provided to `validates_format_of`
210 and the `:multiline` option is not set to true, an exception will be raised. This is
211 to prevent security vulnerabilities when using `validates_format_of`. The problem is
212 described in detail in the Rails security guide.
a17d047 @josevalim Trim down Active Model API by removing valid? and errors.full_messages
josevalim authored
213
05857ec @fxn did a pass over the AM changelog [ci skip]
fxn authored
214 *Jan Berdajs + Egor Homakov*
bc7c0b5 @mrbrdo prevent users from unknowingly using bad regexps that can compromise …
mrbrdo authored
215
810a50d @fxn CHANGELOGs are now per branch
fxn authored
216 Please check [3-2-stable](https://github.com/rails/rails/blob/3-2-stable/activemodel/CHANGELOG.md) for previous changes.
Something went wrong with that request. Please try again.