我有三个模型User,Individual和Business.我还为每个创建了三个表.我的个人和用户表是相同的所以我从user.rb继承我的问题是当我来到business.rb时,我能够访问User的所有父属性(例如:first_name)但我无法访问该模型business表中的特定属性(例如:company_name).
class User < ApplicationRecord
# This is the user model
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable,
:confirmable, :lockable, :timeoutable
enum status: {unverified: 0, verified: 1}
end
# This is the business model
class Business < User
end
individual.rb
# # This is the individual model
class Individual < User
end
schema.rb
# This is the schema for all the models
ActiveRecord::Schema.define(version: 2018_06_09_091056) do
create_table "businesses", force: :cascade do |t|
t.string "company_address"
t.string "company_name"
t.string "company_phone_number"
t.text "documents"
end …Run Code Online (Sandbox Code Playgroud)