Use quote_value method to avoid undefined method `type_cast_for_database' for nil:NilClass
Merge pull request #486 from yahonda/rails42_type_cast_for_database

Rails4.2 Use quote_value method to avoid undefined method `type_cast_for_database' for nil:NilClass