On 8 May 2014 14:13, S Ahmed <[email protected]> wrote:
> Hi,
>
> I have the following:
>
> GET  /account/create
> POST /account/oncreate
>
> My create action looks like:
>
> def create
>  @user = User.new
> end
>
> def oncreate
>   @user = User.new(params)
>   if @user.valid?
>        ...
>    else
>        render 'create'

That is better as
render action: 'create'
or
render :action => 'create'
but I would have expected an error if it did not work.  Are you sure
the validation is failing?  Put some debug code after the if line, if
you use puts then it will be printed to the server terminal window.

Also it is normally better to use the standard actions new and create
rather than create and oncreate.  If you have not already done so then
work right through a good tutorial such as railstutorial.org (which is
free to use online) which will show you the basics of rails.

Colin

Colin

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLvpTWbsRVQ6r%2BECqNKUq4sHO46FGNF19hBtsK-2A6q0bw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to