내 응용 프로그램에 문제가 있습니다. 볼링 게임이 있습니다. 최종 결과를 이름으로 생성합니다. 내 데이터베이스에 삽입하는 문제가볼링 앱에 데이터베이스에 삽입 할 수 없습니다.
보기 :
<%= form_for player_index_path(@player) do |f|%>
<div class="text_field">
<p>
<%= f.label "Spelare namn" %>
<%= f.text_field :name %>
</p>
<p>
<%= f.submit "Lägg till spelare"%>
</p>
</div>
<%end%>
클래스 플레이어 < 액티브 :: 자료 attr_accessible : belongs_to 이름 : 결과 끝
컨트롤러 :
def create
@player = Player.new(params[:player])
if @player.save
render :action => "index"
else
render :action => "new"
end
end
이주 :
class CreatePlayers < ActiveRecord::Migration
def change
create_table :players do |t|
t.string "name"
t.references :results
t.timestamps
end
끝 끝 레일의
와
대체 당신은 당신의 모델을 보여줄 수 있습니까? –
이제 모델이 생겼습니다! – Max