Very noobish question

So I just started with rails a few days ago and I am wondering why this
does not work. I get an ArgumentError in User#create

Extracted source (around line #2):

1:
2: <% form.for :user, @user, :url => {:action => "create"}, :html =>
{:class => "create_form"} do |f| %>
3:
4: <p>
5: <%= f.label :username %><br />

I believe this is what is relevant to what is causing the error

views/user/create.html.erb

<% form.for :user, @user, :url => {:action => "create"}, :html =>
{:class => "create_form"} do |f| %>
  <p>
      <%= f.label :username %><br />
      <%= f.text_field :username %>
  </p>
  <p>
      <%= f.label :password %><br />
      <%= f.text_field :password %>
  </p>
  <p>
      <%= f.label :first %><br />
      <%= f.text_field :first %>
  </p>
  <p>
      <%= f.label :last %><br />
      <%= f.text_field :last %>
  </p>
  <p>
      <%= f.label :email %><br />
      <%= f.text_field :email %>
  </p>

  <p>
    <%= f.submit_tag 'Sign Up' %>
  </p>
<% end %>

controllers/user_controller.rb

class UserController < ActionController::Base
  def index
    @users = User.all
  end
  def create
    p params
    @user = User.new
    #@user.first = params[:user][:first]
    #@user.last = params[:user][:last]
    #@user.username = params[:user][:username]
    #@user.password = params[:user][:password]
  end
end

So I just started with rails a few days ago and I am wondering why this
does not work. I get an ArgumentError in User#create

Extracted source (around line #2):

1:
2: <% form.for :user, @user, :url => {:action => "create"}, :html =>

That looks like a typo - it's form_for, not form.for

Fred

Try to understand the standard 7 object method called restfull API and it will make your life easier in rails. Application. Try checking http://railscas.com for a start.

Cheers,

Andre

Try to understand the standard 7 object method called restfull API and it will make your life easier in rails. Application. Try checkinghttp://railscas.comfor a start.

Its actually http://www.railscasts.com

ryan bate's video screencasts, they really realy help