Skip to content

Persist your objects to Cassandra -- conforms to ActiveModel API

License

Notifications You must be signed in to change notification settings

Lytol/cassandra_model

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CassandraModel

Persist your objects to Cassandra -- conforms to ActiveModel API

Getting Started

Note: If you haven't already, make sure you have Cassandra configured and running. Here are a few resources to get you started:

Configuration

You must configure CassandraModel with your keyspace and hosts:

CassandraModel.config(:keyspace => "MyApp", :hosts => "127.0.0.1:9160")

Define a Model

class User
  include CassandraModel::Resource
  
  column :email
  column :name
end

Creating

@user = User.new(:email => '[email protected]', :name => "Brian Smith")
@user.save
puts "Key: #{@user.key}"  # Note that a key will be auto-generated (GUID) if none is given

Fetching

@user = User.get("11cb871a-338b-11df-9f62-ef46bcab0d62")
puts "#{@user.email} / #{@user.name}"

Copyright

Copyright (c) 2010 Brian Smith. See LICENSE for details.

About

Persist your objects to Cassandra -- conforms to ActiveModel API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages