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:
5: <%= f.label :username %>
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| %>
<%= f.label :username %>
<%= f.text_field :username %>
<%= f.label :password %>
<%= f.text_field :password %>
<%= f.label :first %>
<%= f.text_field :first %>
<%= f.label :last %>
<%= f.text_field :last %>
<%= f.label :email %>
<%= f.text_field :email %>
<%= f.submit_tag 'Sign Up' %>
<% 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
Dd Ss 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
Yes? And what’s the rest of the error message?
Best,
–Â
Marnen Laibow-Koser
http://www.marnen.org
[email protected]
Sent from my iPhone
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
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
Sent from my iPhone
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
I’m not sure if this is the reason or not, but “form.for” should be
“form_for” in views/user/create.html.erb.
Hope this helps.
I’m not sure if this is the reason, but "form.for " should be
“form_for”