Skip to content

Commit

Permalink
Fixed PostgreSQL casting for Rails 4.0+
Browse files Browse the repository at this point in the history
  • Loading branch information
ankane committed Jun 16, 2014
1 parent 4651c3e commit 1be5333
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/activeuuid/patches.rb
Expand Up @@ -43,6 +43,12 @@ module PostgreSQLColumn
extend ActiveSupport::Concern

included do
def type_cast_with_uuid(value)
return UUIDTools::UUID.serialize(value) if type == :uuid
type_cast_without_uuid(value)
end
alias_method_chain :type_cast, :uuid if ActiveRecord::VERSION::MAJOR >= 4

def simplified_type_with_pguuid(field_type)
return :uuid if field_type == 'uuid'
simplified_type_without_pguuid(field_type)
Expand Down

0 comments on commit 1be5333

Please sign in to comment.