I can't insert to my database rails

i can't insert to my database whats is my problem?

it's bowling game and i have two tables with name "Player" and "Result"


<%= form_for player_new_path(@player) do |f|%>
<div class="text_field">
    <%= f.label "Spelare namn" %>
    <%= f.text_field :name %>
    <%= f.submit "Lägg till en spelare"%>
 def create
   @player = Player.new(params[:players])

  if @player.save
    redirect_to players_new_path
  render :action => "new"


Not work :/ my model:

class Player < ActiveRecord::Base # attr_accessible :title, :body 
    belongs_to :result 

and my migrations:

class CreatePlayers < ActiveRecord::Migration
    def change 
        create_table :players do |t|
        t.string "name"
        t.references :results 


Check your params hash. I bet the key isn't 'players', it's probably 'player'.

@player = Player.new(params[:players]) should probably be @player = Player.new(params[:player]) (You are getting a single player as a param)

Otherwise, what error are you getting

Need Your Help

How i can map entity whit composite key mvc 4 entity framework 5

c# asp.net-mvc entity-framework asp.net-mvc-4

I have the next problem i am trying map this entity model but when mi app call the entity this entity has not related whit the other class and any o you data, i have the code:

Blackberry User Interface Design - Customizable UI?

user-interface blackberry custom-controls skin

I am trying to design a Blackberry Application and I am wondering if there are any resources on how to create custom user interface elements, skin existing ones and what other possibilities are the...