... the strange thing is, the code I have written is axactly the same as that in the railsspace website.... (http://railsspace.com/4_register/listing-4-20.txt)
On 28 Aug, 14:33, RubyonRails_newbie <craigwest...@googlemail.com> wrote: > cheers Colin - i'll try this out. > > On 28 Aug, 14:26, Colin Law <clan...@googlemail.com> wrote: > > > > > 2009/8/28 RubyonRails_newbie <craigwest...@googlemail.com>: > > > > Hello, > > > > I am following the RailsSpace tutorial and am at the point where I am > > > creating a new user through (user/register) > > > > I have added the details into the form: screen_name, email and > > > password. > > > > When I click register, I would expect this to be saved (commited) to > > > the database. > > > > However – when I look in the terminal, it says ‘Rollback’ instead of > > > ‘COMMIT’ > > > > The code in the user controller looks like this: > > > > class UserController < ApplicationController > > > > def register > > > �...@title = "Register" > > > if request.post? and params[:user] > > > �...@user = User.new(params[:user]) > > > if @user.save > > > flash[:notice] = "User #...@user.screen_name} created!" > > > redirect_to :action => "index" > > > I would expect see something like this here, for the case when the save > > fails > > else > > render :action => "new or whatever is is the action that > > posted to register" > > > > end > > > end > > > end > > > > Does anyone know why in my terminal it is not saving this as I’d > > > expect? > > > Maybe your validations are failing, if you have the else condition > > above and then in the new action (or whatever it is) inside the > > form_for you should have <%= f.error_messages %> and the errors will > > appear. > > > Colin- Hide quoted text - > > > - Show quoted text -- Hide quoted text - > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---