On Jul 10, 8:37 am, Dd Ss <[email protected]> wrote:
> 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

> {: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
>     #[email protected] = params[:user][:first]
>     #[email protected] = params[:user][:last]
>     #[email protected] = params[:user][:username]
>     #[email protected] = params[:user][:password]
>   end
> end
> --
> Posted viahttp://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to