Skip to content

Commit

Permalink
Upgraded to Virtus 1.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
dblock committed Oct 17, 2013
1 parent 5d6a0a8 commit 67d3f79
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Next Release

* [#475](https://github.com/intridea/grape/pull/475): Added support for the `:jsonapi`, `application/vnd.api+json` media type registered at http://jsonapi.org - [@bcm](https://github.com/bcm).
* [#471](https://github.com/intridea/grape/issues/471): Added parameter validator for a list of allowed values - [@vickychijwani](https://github.com/vickychijwani).
* [#488](https://github.com/intridea/grape/issues/488): Upgraded to Virtus 1.0 - [@dblock](https://github.com/dblock).

#### Fixes

Expand Down
2 changes: 1 addition & 1 deletion grape.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Gem::Specification.new do |s|
s.add_runtime_dependency 'multi_json', '>= 1.3.2'
s.add_runtime_dependency 'multi_xml', '>= 0.5.2'
s.add_runtime_dependency 'hashie', '>= 1.2.0'
s.add_runtime_dependency 'virtus'
s.add_runtime_dependency 'virtus', '>= 1.0.0'
s.add_runtime_dependency 'builder'

s.add_development_dependency 'grape-entity', '>= 0.2.0'
Expand Down
4 changes: 2 additions & 2 deletions lib/grape/validations/coerce.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ def valid_type?(val)
end

def coerce_value(type, val)
converter = Virtus::Attribute.build(:a, type)
converter = Virtus::Attribute.build(type)
converter.coerce(val)

# not the prettiest but some invalid coercion can currently trigger
# errors in Virtus (see coerce_spec.rb)
# errors in Virtus (see coerce_spec.rb:75)
rescue
InvalidValue.new
end
Expand Down
2 changes: 1 addition & 1 deletion spec/grape/validations/coerce_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def app; subject end
context 'complex objects' do
module CoerceValidatorSpec
class User
include Virtus
include Virtus.model
attribute :id, Integer
attribute :name, String
end
Expand Down

0 comments on commit 67d3f79

Please sign in to comment.