it is my first time using Ruby subclass inheritence. I have a parent class A with an attribute "name:string", and a child class B < A with an attribute "bankname:string".
When I use rails console to create a B instance (B.new) I get an object with "name:string" only, and without the "bankname:string" attribute.
My Schema looks like this:
create_table "a", force: :cascade do |t|
t.string "name"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "b", force: :cascade do |t|
t.string "bankname"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
My models are:
class A < ApplicationRecord
end
class B < A
end
Console:
2.4.0 :010 > c = B.new
=> #<B id: nil, name: nil, created_at: nil, updated_at: nil>