我需要一些帮助。我有 2 节课:
共享信息
class SharedInfo < ActiveRecord::Base
attr_accessible :shared_info_type_id, :severity_id, :source_info_id, :created_date
belongs_to :Severity, :foreign_key => :severity_id
belongs_to :SharedInfoType, :foreign_key => :shared_info_type_id
belongs_to :SourceInfo, :foreign_key => :source_info_id
end
严重性
class Severity < ActiveRecord::Base
has_many :SharedInfo, :foreign_key => :severity_id
end
问题是:
我有一个 class@sharedinfo
实例SharedInfo
。当我调用以下语句时:
@sharedinfo.Severity
它返回一个错误:“未定义”。我究竟做错了什么?