From afe402dac7da9e2e9d0f3e29582a502d8596d0e0 Mon Sep 17 00:00:00 2001 From: Yves Senn Date: Sat, 31 Jan 2015 11:54:00 +0100 Subject: unify CHANGELOG format. [ci skip] --- activemodel/CHANGELOG.md | 62 +++++++++++++++++++++++------------------------- 1 file changed, 30 insertions(+), 32 deletions(-) (limited to 'activemodel/CHANGELOG.md') diff --git a/activemodel/CHANGELOG.md b/activemodel/CHANGELOG.md index 77386e5e41..5830a00bc5 100644 --- a/activemodel/CHANGELOG.md +++ b/activemodel/CHANGELOG.md @@ -2,48 +2,46 @@ will now raise `ActiveModel::AttributeAssignment::UnknownAttributeError` instead of `NoMethodError` - ```ruby - User.new(foo: 'some value') - # => ActiveModel::AttributeAssignment::UnknownAttributeError: unknown attribute 'foo' for User. - ``` + Example: + + User.new(foo: 'some value') + # => ActiveModel::AttributeAssignment::UnknownAttributeError: unknown attribute 'foo' for User. *Eugene Gilburg* * Extracted `ActiveRecord::AttributeAssignment` to `ActiveModel::AttributeAssignment` - allowing to use it for any object as an includable module - - ``` ruby - class Cat - include ActiveModel::AttributeAssignment - attr_accessor :name, :status - end - - cat = Cat.new - cat.assign_attributes(name: "Gorby", status: "yawning") - cat.name # => 'Gorby' - cat.status => 'yawning' - cat.assign_attributes(status: "sleeping") - cat.name # => 'Gorby' - cat.status => 'sleeping' - ``` + allowing to use it for any object as an includable module. + + Example: + + class Cat + include ActiveModel::AttributeAssignment + attr_accessor :name, :status + end + + cat = Cat.new + cat.assign_attributes(name: "Gorby", status: "yawning") + cat.name # => 'Gorby' + cat.status => 'yawning' + cat.assign_attributes(status: "sleeping") + cat.name # => 'Gorby' + cat.status => 'sleeping' *Bogdan Gusiev* * Add `ActiveModel::Errors#details` To be able to return type of used validator, one can now call `details` - on Errors instance: - - ```ruby - class User < ActiveRecord::Base - validates :name, presence: true - end - ``` - - ```ruby - user = User.new; user.valid?; user.errors.details - => {name: [{error: :blank}]} - ``` + on errors instance. + + Example: + + class User < ActiveRecord::Base + validates :name, presence: true + end + + user = User.new; user.valid?; user.errors.details + => {name: [{error: :blank}]} *Wojciech Wnętrzak* -- cgit v1.2.3