Hugo Demiglio
Hugo Demiglio

Reputation: 1589

Cassandra with Rails 3.2, connection error

I'm using the gem cassandra_object, follow the steps in the README.

I run the rails in the development environment, it began smoothly, but when I open the browser it displays the error: "ActiveRecord:: ConnectionNotEstablished".

The cassandra server is running perfectly.

Below is the configuration file:

ROOT/config/initializers/cassandra.rb:

CassandraObject::Base.establish_connection(
  keyspace: 'my_app_development',
  servers: '127.0.0.1:9160',
  thrift: {
    timeout: 20,
    retries: 2
  }
)

ROOT/Gemfile:

source 'https://rubygems.org'

gem 'rails', '3.2.1'

gem 'thrift_client', '~> 0.7.0'
gem 'cassandra'
gem 'gotime-cassandra_object'

Browser error (http://localhost:3000/):

ActiveRecord::ConnectionNotEstablished

Thanks!

Upvotes: 1

Views: 764

Answers (1)

Hugo Demiglio
Hugo Demiglio

Reputation: 1589

To solve this problem, just disable the ActiveRecord.

On file ROOT/config/application.rb, remove this line:

require 'rails/all'

and include this code:

require "action_controller/railtie"
require "action_mailer/railtie"
require "active_resource/railtie"
require "rails/test_unit/railtie"

comment line:

config.active_record.schema_format = :sql

and comment out this line also:

config.active_record.whitelist_attributes = true

Doing these steps in application.rb, the cassandra worked.

Thanks.

Upvotes: 3

Related Questions