aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/CHANGELOG.md
Commit message (Collapse)AuthorAgeFilesLines
* Tweaks CHANGELOGs and docs [ci skip]Ryuta Kamizono2019-03-311-2/+2
| | | | | | | * add leading `#` before `=>` since hash rocket is valid Ruby code * add backticks * remove trailing spaces * and more
* Merge pull request #35794 from kamipo/type_cast_symbol_falseRyuta Kamizono2019-03-301-0/+6
|\ | | | | Type cast falsy boolean symbols on boolean attribute as false
| * Type cast falsy boolean symbols on boolean attribute as falseRyuta Kamizono2019-03-301-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before 34cc301, type casting by boolean attribute when querying is a no-op, so finding by truthy boolean string (i.e. `where(value: "true") # => value = 'true'`) didn't work as expected (matches it to FALSE in MySQL #32624). By type casting is ensured, a value on boolean attribute is always serialized to TRUE or FALSE. In PostgreSQL, `where(value: :false) # => value = 'false'` was a valid SQL, so 34cc301 is a regresson for PostgreSQL since all symbol values are serialized as TRUE. I'd say using `:false` is mostly a developer's mistake (user's input basically comes as a string), but `:false` on boolean attribute is serialized as TRUE is not a desirable behavior for anybody. This allows falsy boolean symbols as false, i.e. `klass.create(value: :false).value? # => false` and `where(value: :false) # => value = FALSE`. Fixes #35676.
* | Rename `i18n_full_message` config option to `i18n_customize_full_message`Prathamesh Sonpatki2019-03-291-1/+1
|/ | | | | | - I feel `i18n_customize_full_messages` explains the meaning of the config better. - Followup of https://github.com/rails/rails/pull/32956
* Merge tag 'v6.0.0.beta3'eileencodes2019-03-131-6/+12
|\ | | | | | | v6.0.0.beta3 release
| * Prep releaseeileencodes2019-03-111-0/+5
| | | | | | | | | | | | | | * Update RAILS_VERSION * Bundle * rake update_versions * rake changelog:header
* | Edit a changelog entry [ci skip]Sharang Dashputre2019-03-121-4/+3
| |
* | Update Changelog with new locale fallback behavior on validationHugo Vacher2019-03-111-0/+24
|/
* Preparing for 6.0.0.beta2 releaseRafael Mendonça França2019-02-251-0/+2
|
* Merge pull request #29651 from Sayanc93/return-correct-dateRyuta Kamizono2019-02-181-1/+18
|\ | | | | | | Return correct date in ActiveModel for time to date conversions
| * Return correct date in ActiveModel for time to date conversionsSayan Chakraborty2017-12-171-1/+16
| | | | | | | | | | | | | | time.to_date conversion happens considering leap years so a conversion of "Day.new({'day(1i)'=>'1', 'day(2i)'=>'1', 'day(3i)'=>'1'})" results in saving the date as Mon, 03 Jan 0001 which might seem weird on the user level, hence falling back to parsing on string level resolves this data mismatch Fixes #28521
* | Fix year value when casting a multiparameter time hashAndrew White2019-01-211-0/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When assigning a hash to a time attribute that's missing a year component (e.g. a `time_select` with `:ignore_date` set to `true`) then the year defaults to 1970 instead of the expected 2000. This results in the attribute changing as a result of the save. Before: event = Event.new(start_time: { 4 => 20, 5 => 30 }) event.start_time # => 1970-01-01 20:30:00 UTC event.save event.reload event.start_time # => 2000-01-01 20:30:00 UTC After: event = Event.new(start_time: { 4 => 20, 5 => 30 }) event.start_time # => 2000-01-01 20:30:00 UTC event.save event.reload event.start_time # => 2000-01-01 20:30:00 UTC
* | Preparing for 6.0.0.beta1 releaseRafael Mendonça França2019-01-181-0/+2
| |
* | Add `ActiveModel::Errors#of_kind?`bogdanvlviv2019-01-041-0/+4
| | | | | | | | Related to https://github.com/rails/rails/pull/34817#issuecomment-451508668
* | Require Ruby 2.5 for Rails 6.Kasper Timm Hansen2018-12-191-2/+2
| | | | | | | | | | | | | | | | | | | | Generally followed the pattern for https://github.com/rails/rails/pull/32034 * Removes needless CI configs for 2.4 * Targets 2.5 in rubocop * Updates existing CHANGELOG entries for fewer merge conflicts * Removes Hash#slice extension as that's inlined on Ruby 2.5. * Removes the need for send on define_method in MethodCallAssertions.
* | Fix numericality equality validation on floatsGannon McGibbon2018-12-121-0/+5
| |
* | Add slice! method to ActiveModel::ErrorsDaniel Lopez Prat2018-11-211-0/+4
| |
* | Formatting CHANGELOGs [ci skip]Ryuta Kamizono2018-09-071-12/+13
| | | | | | | | Fixing code block rendering, indentation, backticks, etc.
* | Fix numericality validator to still use value before type cast except Active ↵Ryuta Kamizono2018-08-241-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Record The purpose of fe9547b is to work type casting to value from database. But that was caused not to use the value before type cast even except Active Record. There we never guarantees that the value before type cast was going to the used in this validation, but we should not change the behavior unless there is some particular reason. To restore original behavior, still use the value before type cast if `came_from_user?` is undefined (i.e. except Active Record). Fixes #33651. Fixes #33686.
* | Add changelog entry for #31503 [ci skip]bogdanvlviv2018-08-121-0/+16
| | | | | | | | Related to #31503
* | has_secure_password: use `recovery_password` instead of `activation_token`bogdanvlviv2018-07-081-4/+4
| | | | | | | | | | | | Since we have `has_secure_token`, it is too confusing to use `_token` suffix with `has_secure_password`. Context https://github.com/rails/rails/pull/33307#discussion_r200807185
* | Merge pull request #26764 from choncou/improve_has_secure_passwordRafael Mendonça França2018-06-281-0/+18
|\ \ | | | | | | | | | Allow configurable attribute name on `#has_secure_password`
| * | Remove method for regenerating a token, and update `#authenticate`.Unathi Chonco2016-10-121-10/+7
| | | | | | | | | | | | | | | | | | | | | This change now creates a method `#authenticate_XXX` where XXX is the configured attribute name on `#has_secure_password`. `#authenticate` is now an alias to this method when the attribute name is the default 'password'
| * | This addition will now allow configuring an attribute name for theUnathi Chonco2016-10-121-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | existing `#has_secure_password`. This can be useful when one would like to store some secure field as a digest, just like a password. The method still defaults to `password`. It now also allows using the same `#authenticate` method which now accepts a second argument for specifying the attribute to be authenticated, or will default to 'password`. A new method is also added for generating a new token for an attribute by calling `#regenerate_XXXX` where `XXXX` is the attribute name.
* | | Add changelog for #32956 [ci skip]bogdanvlviv2018-06-121-0/+6
| | | | | | | | | | | | Add mention about default value of `config.active_model.i18n_full_message`.
* | | Remove changelog header for unreleased versionRafael Mendonça França2018-03-131-2/+0
| | | | | | | | | | | | | | | | | | We only add the header when releasing to avoid some conflicts. [ci skip]
* | | Remove CHANGELOG entries which were backported to 5-2-stableRyuta Kamizono2018-02-281-4/+0
| | |
* | | Merge pull request #28270 from mmangino/dont_ignore_seralization_optionsRyuta Kamizono2018-02-271-0/+4
|\ \ \ | | | | | | | | | | | | Don't accidentally lose includes in serialization
| * | | Don't accidentally lose includes in serializationMike Mangino2017-03-031-0/+3
| | | |
* | | | Rails 6 requires Ruby 2.4.1+Jeremy Daer2018-02-171-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | Skipping over 2.4.0 to sidestep the `"symbol_from_string".to_sym.dup` bug. References #32028
* | | | Start Rails 6.0 development!!!Rafael Mendonça França2018-01-301-65/+1
| | | | | | | | | | | | | | | | :tada::tada::tada:
* | | | Allow attributes with a proc default to be marshalledSean Griffin2018-01-231-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We don't implement much custom marshalling logic for these objects, but the proc default case needs to be handled separately. Unfortunately there's no way to just say "do what you would have done but with this value for one ivar", so we have to manually implement `marshal_load` as well. The test case is a little bit funky, but I'd really like an equality test in there, and there's no easy way to add one now that this is out of AR (since the `attributes` method isn't here) Fixes #31216
* | | | Fix validation callbacks on multiple contextYoshiyuki Hirano2017-12-201-0/+4
| |_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I found a bug that validation callbacks don't fire on multiple context. So I've fixed it. Example: ```ruby class Dog include ActiveModel::Validations include ActiveModel::Validations::Callbacks attr_accessor :history def initialize @history = [] end before_validation :set_before_validation_on_a, on: :a before_validation :set_before_validation_on_b, on: :b after_validation :set_after_validation_on_a, on: :a after_validation :set_after_validation_on_b, on: :b def set_before_validation_on_a; history << "before_validation on a"; end def set_before_validation_on_b; history << "before_validation on b"; end def set_after_validation_on_a; history << "after_validation on a" ; end def set_after_validation_on_b; history << "after_validation on b" ; end end ``` Before: ``` d = Dog.new d.valid?([:a, :b]) d.history # [] ``` After: ``` d = Dog.new d.valid?([:a, :b]) d.history # ["before_validation on a", "before_validation on b", "after_validation on a", "after_validation on b"] ```
* | | Preparing for 5.2.0.beta2 releaseRafael Mendonça França2017-11-281-0/+5
| | |
* | | Preparing for 5.2.0.beta1 releaseRafael Mendonça França2017-11-271-0/+2
| | |
* | | Execute `ConfirmationValidator` validation when `_confirmation`'s value is ↵bogdanvlviv2017-11-051-0/+4
| | | | | | | | | | | | `false`
* | | Allow passing a Proc or Symbol as an argument to length validator valuesMatt Rohrer2017-10-261-0/+4
| | | | | | | | | | | | | | | This brings the Length validator in line with the Numericality validator, which currently supports Proc & Symbol arguments
* | | Add ActiveModel::Errors#merge!Jahfer Husain2017-07-071-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ActiveModel::Errors#merge! allows ActiveModel::Errors to append errors from a separate ActiveModel::Errors instance onto their own. Example: person = Person.new person.errors.add(:name, :blank) errors = ActiveModel::Errors.new(Person.new) errors.add(:name, :invalid) person.errors.merge!(errors) puts person.errors.messages # => { name: ["can't be blank", "is invalid"] }
* | | :scissors:Ryuta Kamizono2017-06-281-1/+1
| | | | | | | | | | | | [ci skip]
* | | Fix regression in Numericality validator where extra decimal places on Bradley Priest2017-05-271-0/+5
| | | | | | | | | a user input for a decimal column were ignored by numerically validations
* | | Cleanup CHANGELOGs [ci skip]Ryuta Kamizono2017-04-301-21/+21
| | | | | | | | | | | | | | | | | | * Remove trailing spaces. * Add backticks around method and command. * Fix indentation.
* | | Remove CHANGELOG.md entry that appears in 5-1-stableJon Moss2017-03-291-4/+0
| | | | | | | | | | | | | | | | | | | | | This CHANGELOG.md is a continuation of the 5-1-stable one, there shouldn't be any duplicate entries. [ci skip]
* | | Fix ActiveModel::Errors #keys, #valuesbogdanvlviv2017-03-281-0/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before: person.errors.keys # => [] person.errors.values # => [] person.errors[:name] # => [] person.errors.keys # => [:name] person.errors.values # => [[]] After: person.errors.keys # => [] person.errors.values # => [] person.errors[:name] # => [] person.errors.keys # => [] person.errors.values # => [] Related to #23468
* | | Merge pull request #28050 from namusyaka/avoid-converting-int-into-floatRafael Mendonça França2017-03-271-0/+5
|\ \ \ | | | | | | | | | | | | Avoid converting integer as a string into float
| * | | Avoid converting integer as a string into floatnamusyaka2017-02-181-0/+4
| | | |
* | | | Start Rails 5.2 developmentMatthew Draper2017-03-221-32/+1
| |/ / |/| |
* | | Preparing for 5.1.0.beta1 releaseRafael Mendonça França2017-02-231-0/+2
|/ /
* | Remove deprecated behavior that halts callbacks when the return is falseRafael Mendonça França2017-02-071-0/+4
| |
* | Remove `ActiveModel::TestCase` from libyuuji.yaginuma2017-02-071-0/+4
| | | | | | | | | | | | `ActiveModel::TestCase` is used only for the test of Active Model. Also, it is a private API and can not be used in applications. Therefore, it is not necessary to include it in lib.
* | Merge pull request #26696 from iainbeeston/only-ruby-types-in-activemodelSean Griffin2016-12-081-0/+4
|\ \ | | | | | | | | | Moved database-specific ActiveModel types into ActiveRecord