octopus_establish_connection not working with Inherited class

274 views Asked by At

I am using Octopus 0.8.0 gem and rails version 3.2.16 version.

I have 2 models as follows

class A < ActiveRecord::Base

self.abstract_class = true

octopus_establish_connection("non_default_db")

end

class B < A

end

If I look at A.connection_config it gives me proper result connected to non_default_db connection configuration. But B.connection_config gives me the result of default development connection instead of non_default_db connection configuration.

Here is the result

  A.connection_config result => {:adapter=>"mysql2", :encoding=>"utf8", :reconnect=>true,
                       :database=>"non_default_development", :pool=>5, :username=>"root", 
                       :password=>"123", :host=>"localhost"}

  B.connection_config result => {:adapter=>"mysql2", :encoding=>"utf8", :reconnect=>true,
                       :database=>"development", :pool=>5, :username=>"root",
                       :password=>"123", :host=>"localhost", :flags=>2}

What could be reason for this?

0

There are 0 answers