Cequel Cassandra ORM For Ruby Question

Hi all,

I’m starting a RoR3 project with Cassandra Database using Cequel 1.4.1,
a Ruby ORM for Cassandra. It’s a great ORM and easy to use because of
it’s ActiveRecord-like coding and model association style. But as i go
on with my development using model associations i encountered some
errors and searched for answers, and so i have read the post here about
Cequel by one of the author that’s why i’m hoping that i can get help
here with my problem.

My problems encountered with the given model association are:

class User
include Cequel::Record

has_many :carts
has_many :cart_items

key :id, :uuid, auto: true
column :email, :text
column :encrypted_password, :text
timestamps
end

class Cart
include Cequel::Record

belongs_to :user
has_many :cart_items

key :id, :uuid, auto: true
column :name, :text
timestamps
end

class Product
include Cequel::Record

has_many :cart_items

key :id, :uuid, auto: true
column :name, :text
timestamps
end

class CartItems
include Cequel::Record

belongs_to :user
belongs_to :cart
belongs_to :product
end

  1. For User and Cart model, the association between both the model is
    required upon creation of the data. I want to create either the User or
    the Cart first and set the connection for the both at a later time. I
    also tried putting this code in Cart model but still doesn’t work:
    validates :user_id, presence: false

  2. For CartItems model, running rake cequel:migrate outputs an error
    saying Cequel::Record::InvalidRecordConfiguration: Can’t declare more
    than one belongs_to association.

I hope someone can help me on this, or can give me a better solution or
idea on what i’m trying to achieve here using Cassandra database.
Thanks!

Hi Paul,

I’m the author of Cequel, and I’d be happy to answer your question.
However I suspect the folks in this forum would prefer we have the
discussion on the Cequel forum. Mind re-posting your question here?

https://groups.google.com/forum/#!forum/cequel

Thanks!
Mat

Hi Mat,

I have posted my question on
Redirecting to Google Groups.

Thanks!