README.md in virtus-1.0.4 vs README.md in virtus-1.0.5

- old
+ new

@@ -8,11 +8,11 @@ Virtus ====== # Ruby Object Mapper -[![Gem Version](https://badge.fury.io/rb/rom.svg)][gem] +[![Gem Version](https://badge.fury.io/rb/virtus.svg)][gem] [![Build Status](https://travis-ci.org/solnic/virtus.svg?branch=master)][travis] [![Dependency Status](https://gemnasium.com/solnic/virtus.png)][gemnasium] [![Code Climate](https://codeclimate.com/github/solnic/virtus/badges/gpa.svg)][codeclimate] [![Test Coverage](https://codeclimate.com/github/solnic/virtus/badges/coverage.svg)][codeclimate] [![Inline docs](http://inch-ci.org/github/solnic/virtus.svg?branch=master)][inchpages] @@ -58,16 +58,16 @@ attribute :name, String attribute :age, Integer attribute :birthday, DateTime end -user = User.new(:name => 'Piotr', :age => 29) -user.attributes # => { :name => "Piotr", :age => 29 } +user = User.new(:name => 'Piotr', :age => 31) +user.attributes # => { :name => "Piotr", :age => 31 } user.name # => "Piotr" -user.age = '29' # => 29 +user.age = '31' # => 31 user.age.class # => Fixnum user.birthday = 'November 18th, 1983' # => #<DateTime: 1983-11-18T00:00:00+00:00 (4891313/2,0/1,2299161)> # mass-assignment @@ -505,9 +505,25 @@ end # this will raise an error User.new :admin => "can't really say if true or false" ``` + +## Nullify Blank Strings Mode + +If you want to replace empty Strings with `nil` values (since they can't be +coerced into the expected type), you can use the `:nullify_blank` option. + +``` ruby +class User + include Virtus.model(:nullify_blank => true) + + attribute :birthday, Date +end + +User.new(:birthday => "").birthday # => nil +``` + ## Building modules with custom configuration You can also build Virtus modules that contain their own configuration.