Class: ActiveRecord::Relation
- Inherits:
-
Object
- Object
- ActiveRecord::Relation
- Defined in:
- lib/pgrel/active_record/relation.rb
Instance Method Summary collapse
Instance Method Details
#update_store(store_name) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/pgrel/active_record/relation.rb', line 5 def update_store(store_name) raise ArgumentError, "Empty store name to update" if store_name.blank? type = type_for_attribute(store_name.to_s).type raise TypeConflictError, store_type_error_msg(type) if %i[hstore jsonb].exclude?(type) klass = "ActiveRecord::Store::Flexible#{type.capitalize}".constantize klass.new(self, store_name) end |