On Tue, Jan 20, 2009 at 8:51 PM, Darren Jeacocke < rails-mailing-l...@andreas-s.net> wrote:
> > My model is being created but isn't saving. It's like it skips straight > past saving. Any ideas why it might do this? Updating works fine. > > def create > @volunteer = Volunteer.new(params[:volunteer]) > @volunteer.save > redirect_to(volunteers_url) > end > > #save returns true if successful, false otherwise. The code generated by the scaffold typically looks something like: if @volunteer.save flash[:notice] = "New volunteer successfully added to database." format.html { redirect_to(volunteers_url) } format.xml { render :xml => @volunteer, :status => :created, :location => @volunteer } else format.html { render :action => "new" } format.xml { render :xml => @volunteer.errors, :status => :unprocessable_entity } end Your volunteer model is probably failing a validation or two. Try looking in your development log. --wpd --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---