두 모델이 있습니다. 작업 및 위치has_one 관계 컨트롤러 업데이트 레일 3
각 작업 has_one 위치
task.rb
has_one :location
나는 위치 모델 내 컨트롤러를 만들려고하고 있습니다. 이 현재 모든 기능이 업데이트를 제외하고 제대로 작동 새로운 형태
<%= form_for(@task.build_Location, :url => task_Location_path(@task)) do |f| %>
Fields
<%= f.submit %>
<% end %>
및 편집 양식
<%= form_for(@task.Location, :url => task_Location_path(@task)) do |f| %>
Fields
<%= f.submit %>
<% end %>
입니다.
def create
@location = @task.create_Location(params[:location])
end
def update
@location = @task.locations.find(params[:id])
end
이 방법을 정의하는 적절한 방법은 무엇입니까?
'을 (PARAMS는 [: 위치])'난 그냥 – MrYoshiji