Sha256: d9d12e12fd4899cc1716928f4ca222aecc323d5731eb4e7335c8b5c2f99c3607
Contents?: true
Size: 1.19 KB
Versions: 2
Compression:
Stored size: 1.19 KB
Contents
require 'cassandra_object/associations/one_to_many' require 'cassandra_object/associations/one_to_one' module CassandraObject module Associations extend ActiveSupport::Concern included do class_inheritable_hash :associations end module ClassMethods def column_family_configuration super << {:Name=>"#{name}Relationships", :CompareWith=>"UTF8Type", :CompareSubcolumnsWith=>"TimeUUIDType", :ColumnType=>"Super"} end def association(association_name, options= {}) if options[:unique] write_inheritable_hash(:associations, {association_name => OneToOneAssociation.new(association_name, self, options)}) else write_inheritable_hash(:associations, {association_name => OneToManyAssociation.new(association_name, self, options)}) end end def remove(key) begin ActiveSupport::Notifications.instrument("remove.cassandra_object", :key => key) do connection.remove("#{name}Relationships", key.to_s) end rescue Cassandra::AccessError => e raise e unless e.message =~ /Invalid column family/ end super end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
gotime-cassandra_object-0.7.2 | lib/cassandra_object/associations.rb |
gotime-cassandra_object-0.7.1 | lib/cassandra_object/associations.rb |