0
自分のアプリケーションを実行している間、私はこのエラーを取得しています:エラー:ActiveRecordは:: UnknownAttributeError(研究のための未知の属性「study_type_question_group_id」。):
ActiveRecord::UnknownAttributeError (unknown attribute 'study_type_question_group_id' for Study.):
app/controllers/protocols_controller.rb:46:in `create'
を私はいくつかのオンラインソリューション貫通行ったが解決できていません問題。カラム 'id'は私の 'study_type_question_group'テーブルで利用可能です。
My controller code : (a fraction of my full code)
--------------------------------------------------
def create
unless from_portal?
@service_request = ServiceRequest.find session[:service_request_id]
end
@current_step = cookies['current_step']
new_protocol_attrs = params[:study] || params[:project] || Hash.new
@protocol = self.model_class.new(new_protocol_attrs.merge
(study_type_question_group_id: StudyTypeQuestionGroup.active.pluck(:id).first))
@protocol.validate_nct = true
if @current_step == 'cancel'
@current_step = 'return_to_service_request'
elsif @current_step == 'go_back'
@current_step = 'protocol'
@protocol.populate_for_edit
elsif @current_step == 'protocol' and @protocol.group_valid? :protocol
@current_step = 'user_details'
@protocol.populate_for_edit
elsif @current_step == 'user_details' and @protocol.valid?
@protocol.save
@current_step = 'return_to_service_request'
flash[:notice] = "New #{@protocol.type.downcase} created"
if @service_request
@service_request.update_attribute(:protocol_id, @protocol.id) unless @service_request.protocol.present?
@service_request.update_attribute(:status, 'draft')
@service_request.sub_service_requests.each do |ssr|
ssr.update_attribute(:status, 'draft')
end
end
@current_step = 'return_to_service_request'
flash[:notice] = "New #{@protocol.type.downcase} created"
else
@protocol.populate_for_edit
end
cookies['current_step'] = @current_step
if @current_step != 'return_to_service_request'
resolve_layout
end
エンド
私はあなたがそれらを見てみたい場合は、ここで見ることができ、私のプロジェクトで多くのファイルを持っている:https://github.com/ctsiteam/cnmc-sparc-request