Skip to content

Commit

Permalink
Add boolean native datatype support (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
vishalvijay committed Sep 1, 2017
1 parent 60f01f5 commit 184afd2
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
salesforce-orm (1.2.2)
salesforce-orm (1.2.3)
activerecord (~> 3)
activerecord-nulldb-adapter (~> 0)
restforce (~> 2.5)
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ Allowed data types are,
- `:date_time`
- `:date`
- `:array`
- `:boolean`

Default is same data type of given value

Expand Down
3 changes: 3 additions & 0 deletions lib/salesforce-orm/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,9 @@ def cast_to(value:, data_type:)
when :array
return [] if value.blank?
value.split(';')
when :boolean
return nil if value.nil?
value.to_s.downcase == 'true'
else
value
end
Expand Down
2 changes: 1 addition & 1 deletion lib/salesforce-orm/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module SalesforceOrm
VERSION = '1.2.2'.freeze
VERSION = '1.2.3'.freeze
end

0 comments on commit 184afd2

Please sign in to comment.