Error if i don't have 'create' method in user_controller and only have 'new' method

7 views
Skip to first unread message

haxuan lac

unread,
Jun 6, 2013, 4:37:05 PM6/6/13
to rubyonra...@googlegroups.com
I'm trying with chapter 7 in RailsTutorial and have code in
user_controller:



def new
@user = User.new
end

def create
@user = User.new(params[:user])
if @user.save
redirect_to root_url, :notice => "Signed up!"
else
render "new"
end
end

if I remove 'create' method and Running App then have error :

The action 'create' could not be found for UsersController
I don't know why have to 'create' method'?
and how to fix this problem if not using 'create' method.
Thanks....

--
Posted via http://www.ruby-forum.com/.

haxuan lac

unread,
Jun 6, 2013, 5:11:49 PM6/6/13
to rubyonra...@googlegroups.com
Sorry,I can know about this problem.
I think after click in submit Form and Post action of Form is called and
in Route :

POST /users(.:format) users#create
this is reason that this app have to do 'create' method
Reply all
Reply to author
Forward
0 new messages