I have a problem with using Class-Table-Inheritance gem. When I try check in console the correctness of inheritance console return this error:
NoMethodError: undefined method `set_primary_key' for Client (call 'Client.connection' to establish a connection):Class
I define primary key for Client, but there is still error.
class Person < ActiveRecord::Base
acts_as_superclass
self.table_name = 'people'
end
Model Client
class Client < ActiveRecord::Base
inherits_from :person
self.primary_key = "person_id"
end
Part of migration file CreatePeople
create_table :people do |t|
t.string :pesel, null: false
t.string :first_name, null: false
t.string :last_name, null: false
t.string :email, null: false
t.date :date_of_birth, null: false
t.timestamps null: false
end
Part of migration file CreateClients
create_table :clients, :inherits => :person do |t|
end
How to resolve this problem?