CRM 프로젝트에서 새 작업을 만들 때 오류가 발생하지 않습니다. 한 달 전에 회사에서 시작했을 때이 프로젝트를 끝내고 코드베이스를 몇 번 검토 한 후 문제가 보이지 않거나 모든 것이 합쳐지지 않는 곳을 보았습니다. 나는 좌절감 때문에 그것을 간과하는 것처럼 느껴져서 숙련 된 레일 개발자로부터 도움을 요청합니다. 미리 감사드립니다!NoMethodError in JobsController # new
오류가 발생 채용 컨트롤러의관련 섹션 :
# GET /jobs/new
def new
@job = Job.opportunity.new do |j|
if params[:opportunity_id].present?
j.opportunity_id = params[:opportunity_id]
end
채용/새보기 :
<% @job[:opportunity_id] = params[:opportunity_id] %>
<% title "New #{@job.opportunity.name} Job"%>
<%
@job[:name] = @job.opportunity.name
@pm = @job.opportunity.pm_id
%>
<br><br>
<%= render 'form' %>
채용 모델 :
class Job < ActiveRecord::Base
mount_uploader :file1, AttachmentUploader
belongs_to :cost_proposal
belongs_to :opportunity
def Job
has_many :opportunities
end
end
을 schema.rb에서3210
작업 테이블 :
create_table 'jobs', force: true do |t|
t.integer 'cost_proposal_id'
t.string 'number'
t.string 'name'
t.date 'flight_date'
t.string 'flight_sub'
t.string 'camera'
t.string 'roll'
t.string 'map_type'
t.integer 'plan_only'
t.integer 'lab_only'
t.integer 'est_hrs_model'
t.date 'due_date'
t.integer 'edge_job_id'
t.integer 'custom_trans'
t.integer 'comp_inhouse'
t.date 'delivered_date'
t.integer 'done'
t.date 'control_in'
t.string 'control_status'
t.date 'at_date'
t.string 'control_results'
t.integer 'control_check'
t.string 'scan_staff'
t.date 'scan_date'
t.integer 'scan_check'
t.string 'comp_staff'
t.date 'comp_date'
t.integer 'comp_check'
t.string 'comp_sub'
t.date 'comp_sub_due_date'
t.integer 'comp_sub_rec'
t.string 'img_staff'
t.date 'img_date'
t.integer 'img_check'
t.string 'edit_staff'
t.date 'edit_date'
t.integer 'edit_check'
t.text 'notes'
t.string 'file1'
t.string 'file2'
t.string 'file3'
t.string 'file4'
t.string 'file5'
t.string 'add_files'
t.datetime 'created_at'
t.datetime 'updated_at'
t.integer 'flown'
t.integer 'cust_trans'
t.integer 'delivered'
t.string 'at_staff'
t.integer 'at_check'
t.integer 'opportunity_id'
end
어떤 오류가 발생합니까? – PoloniculMov
@PoloniculMov job = Job.opportunity.new do | j | 오류가 발생한 곳입니다. – kmaune