diff --git a/lib/activeuuid/patches.rb b/lib/activeuuid/patches.rb index 7a636ea..15d8687 100644 --- a/lib/activeuuid/patches.rb +++ b/lib/activeuuid/patches.rb @@ -122,10 +122,10 @@ def quote_with_visiting(value, column = nil) quote_without_visiting(value, column) end - def type_cast_with_visiting(value, column = nil) + def type_cast_with_visiting(value, column = nil, *args) value = UUIDTools::UUID.serialize(value) if column && column.type == :uuid value = value.to_s if value.is_a? UUIDTools::UUID - type_cast_without_visiting(value, column) + type_cast_without_visiting(value, column, *args) end def native_database_types_with_pguuid diff --git a/spec/lib/activerecord_spec.rb b/spec/lib/activerecord_spec.rb index 13b54c2..7d74e72 100644 --- a/spec/lib/activerecord_spec.rb +++ b/spec/lib/activerecord_spec.rb @@ -88,6 +88,18 @@ its(:delete) { should be_truthy } its(:destroy) { should be_truthy } end + + context '#save' do + subject { article } + let(:array) { [1, 2, 3] } + + its(:save) { should be_truthy } + + context 'when change array field' do + before { article.some_array = array } + its(:save) { should be_truthy } + end + end end describe UuidArticle do diff --git a/spec/support/migrate/20141017204945_add_array_to_articles.rb b/spec/support/migrate/20141017204945_add_array_to_articles.rb new file mode 100644 index 0000000..b3042db --- /dev/null +++ b/spec/support/migrate/20141017204945_add_array_to_articles.rb @@ -0,0 +1,5 @@ +class AddArrayToArticles < ActiveRecord::Migration + def change + add_column :articles, :some_array, :integer, array: true + end +end