Ruby on Rails: many-to-many association undefined methode on creation
===

I have set up members and teams models using has_many through association.

member.rb


    has_many :teams, :through => :team_members
    has_many :team_members

team.rb


    has_many :members, :through => :team_members
    has_many :team_members

team_member.rb

    belongs_to :member
    belongs_to :team

When I try to create a new team, I get this error:

    undefined method `name' for nil:NilClass

params are:

    {"utf8"=>"✓",
     "authenticity_token"=>"aXpMxWxGlhogfn9EbBWciSjoMrYXbPxG8Kzha14na58=",
     "team"=>{"name"=>"Ruby",
     "email"=>"email@email.com",
     "language"=>"En",
     "link"=>"",
     "logo"=>#<ActionDispatch::Http::UploadedFile:0xb3907f0 @original_filename="You-Are-Great-.gif",
     @content_type="image/gif",
     @headers="Content-Disposition: form-data; name=\"team[logo]\"; filename=\"You-Are-Great-.gif\"\r\nContent-Type: image/gif\r\n",
     @tempfile=#<File:/tmp/RackMultipart20120723-1907-m3bi79>>},
     "commit"=>"Create Team"}

The create method in teams_controller.rb is:

    @team = Team.new(params[:team])

The team doesn't get created unless I assign the attributes manually one by one like 

    @team = Team.new(:name => params[:team][:name], :email => params[:team][:email]...)

and so! any ideas why?
