lib/cassandra_object/base.rb in gotime-cassandra_object-2.2.0 vs lib/cassandra_object/base.rb in gotime-cassandra_object-2.2.1

- old
+ new

@@ -24,21 +24,22 @@ klass end end extend ActiveModel::Naming + include ActiveModel::Conversion extend ActiveSupport::DescendantsTracker include Connection - include PrimaryKey + include Consistency include Identity include Attributes include Persistence include Callbacks include Indexes include Dirty - include Validation + include Validations include Associations include Batches include FinderMethods include Timestamps @@ -56,10 +57,25 @@ @attributes = {}.with_indifferent_access self.attributes = attributes @schema_version = self.class.current_schema_version end - def to_model - self + def to_param + id.to_s if persisted? + end + + def hash + id.hash + end + + def ==(comparison_object) + comparison_object.equal?(self) || + (comparison_object.instance_of?(self.class) && + comparison_object.key == key && + !comparison_object.new_record?) + end + + def eql?(comparison_object) + self == (comparison_object) end end end