The constant HASH_DATA_COLUMNS is being defined on the concern and not the class extending the concern. This causes problems if you happen to have mixed jsonb/hstore columns with the same name across tables.
Consider this failing test scenario in master:
class User < ActiveRecord::Base
include Storext.model
include Squint
store_attribute :settings, :zip_code, String, default: '90210' # this is hstore
end
class Post < ActiveRecord::Base
include Storext.model
include Squint
# ... skip a bunch of unrelated settings ...
store_attribute :settings, :zip_code, String, default: '90210' # this is jsonb
end
test 'HASH_DATA_COLUMNS is not shared between models' do
assert_equal('hstore', User::HASH_DATA_COLUMNS[:settings])
assert_equal('jsonb' , Post::HASH_DATA_COLUMNS[:settings])
end
The constant
HASH_DATA_COLUMNS
is being defined on the concern and not the class extending the concern. This causes problems if you happen to have mixed jsonb/hstore columns with the same name across tables.Consider this failing test scenario in master:
Test Output without the fix:
Also, I think this is the true source of https://github.com/ProctorU/squint/pull/19