Sha256: 463a5d5c88a9f51e11082a33642cd9bff6703eec94f9dcf47d4b9fe21064fef0
Contents?: true
Size: 968 Bytes
Versions: 1
Compression:
Stored size: 968 Bytes
Contents
# activemodel-attribute_changed_specification [![Build Status](https://travis-ci.org/yasuoza/activemodel-attribute_changed_specification.png?branch=master)](https://travis-ci.org/yasuoza/activemodel-attribute_changed_specification) Expand `_changed?` method defined in ActiveModel::Dirty. You can specify changed attribute value. ## Installation Add this gem to your Gemfile ``` gem 'activemodel-attribute_changed_specification' ``` Install via bundle ``` $ bundle ``` ## Usage Specify value changes. ```ruby user = User.new user.name = 'Bob' user.name_changed?(from: nil, to: 'Bob') # => true user.name_changed?(from: 'Paul', to: 'Bob') # => false ``` using only from or to ```ruby user = User.new user.name = 'Bob' user.name_changed?(to: 'Bob') # => true user.name_changed?(from: 'Paul') # => false ``` You can still use original `_changed?` method. ```ruby user = User.new user.name = 'Bob' user.name_changed? # => true ``` ## Supports * rails >= 3.2
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
activemodel-attribute_changed_specification-0.1.3 | README.md |