Sha256: 13555d824a744bd3671be61dd983f539ad0eb69e5da0e0b489d9c9c0691b49d6
Contents?: true
Size: 969 Bytes
Versions: 2
Compression:
Stored size: 969 Bytes
Contents
== Cassandra Object Cassandra Object uses ActiveModel to mimic much of the behavior in ActiveRecord. == Defining Models class Widget < CassandraObject::Base key :uuid attribute :name, type: :string attribute :description, type: :string attribute :price, type: :integer validates :name, presence: :true before_create do self.description = "#{name} is the best product ever" end end == Creating and updating records Cassandra Object has equivalent methods as ActiveRecord: widget = Widget.new widget.valid? widget = Widget.create(name: 'Acme', price: 100) widget.update_attribute(:price, 1200) widget.update_attributes(price: 1200, name: 'Acme Corporation') widget.attributes = {price: 300} widget.price_was widget.save widget.save! == Finding records widget = Widget.find(uuid) widget = Widget.first widgets = Widget.all Widget.find_each do |widget| ... end CQL is currently not supported
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
gotime-cassandra_object-2.3.6 | README.rdoc |
gotime-cassandra_object-2.3.5 | README.rdoc |