【发布时间】:2015-10-26 19:53:09
【问题描述】:
我正在尝试使用 Ruby on Rails 和 Cassandra 数据库创建一个简单的应用程序。我正在使用cequel gem,在安装 cequel 之后,我创建了 2 个模型。博客和帖子。
博客.rb
class Blog < ActiveRecord::Base
include Cequel::Record
key :subdomain, :text
column :name, :text
column :description, :text
end
Post.rb
class Post < ActiveRecord::Base
include Cequel::Record
belongs_to :blog
key :id, :uuid
column :title, :text
column :body, :text
end
这是 2 个迁移文件:
class CreateBlogs < ActiveRecord::Migration
def change
create_table :blogs do |t|
t.text :name
t.text :description
t.timestamps null: false
end
end
end
class CreatePosts < ActiveRecord::Migration
def change
create_table :posts do |t|
t.key :id
t.key :timeuuid
t.text :title
t.text :body
t.timestamps null: false
end
end
end
然后我尝试运行此命令 rake cequel:migrate 以将模型的架构与 cassandra 数据库中的架构同步,但我收到此错误:
NoMethodError: undefined method `unpack' for :subdomain:Symbol
我正在与: 卡桑德拉版本:2.0.11 Rails 版本:4.2.4
【问题讨论】:
标签: ruby-on-rails cassandra cassandra-2.0