차량 세부 정보, 불만 사항 및 사용자 세부 정보가있는 단일 양식이 있습니다. 차량 has_many 불만 사항 및 사용자 has_many 불만 사항. nested_attribute 양식이 있지만 어떤 이유로 협회가 잘못되었다고 느낍니다. 나는 조금 혼란스러워 양식이 있어야합니다 아니면 그것은 불만 hashone 차량 및 불만 has_one 사용자가 있어야 ?? 그리고 complaint.This 양식을 작성 IM 모든 인증이없는 새로운 사용자와 새로운 차량을 만드는 IM ..중첩 된 속성이있는 레일 3 복합 양식
Vehicle.rb
class Vehicle < ActiveRecord::Base
attr_accessible :number, :vehicle_types , :complaints_attributes
has_many :complaints
accepts_nested_attributes_for :complaints
end
User.rb
class User < ActiveRecord::Base
attr_accessible :address, :email_id, :mobile , :complaints_attributes
has_many :complaints
accepts_nested_attributes_for :complaints
end
불만 .rb
class Complaint < ActiveRecord::Base
attr_accessible :indecent_behaviour, :occurence_date_time, :other_complaints, :place_occurence
belongs_to :user
belongs_to :vehicle
end
감사합니다.
덕분에 새로운 사용자와 새로운 차량을 만드는 메신저 메신저 불만을 만들 때 : 불평하는 CURRENT_USER의 has_many 협회를 통해 불만을 만들기 이 양식에는 인증이 없습니다 .. – shiva