From: miriamraphael@... Date: 2005-11-30T18:07:31+09:00 Subject: How to properly debug? I am writing my first rails script and am having lots of trouble doing the simplest tasks. Right now, I have a form (new.rhtml) and it allows someone to become a new user by entering their info (username, password, name, etc). the form calls the 'create' routine which is supposed to save it to the DB. However, the data is not being saved. How can I debug this? I am a perl scripter and with Perl I know how to find out where the bugs are, but because I'm new to ruby/rails, I can't figure this out. Here is the form:
Please choose a username and password to create your account
User Name*:
Password*:
Account Information
Company Name*:
First Name*:
Last Name*:
Email Address*:
Address 1*:
Address 2:
City*:
Zip Code*:
Phone*:
Mobile*:
Here is my user controller with the create routine: class UserController < ApplicationController ActiveRecord::Validations::ClassMethods scaffold :user def new @user = User.new @mystates = State.find_all end def create @newuser = User.new(@params['user']) @newuser.creation_date = Date.today @newuser.last_login = Date.today @newuser.save end end Here is my user table definition: create table users ( id int auto_increment not null unique, username varchar(15) not null, password varchar (16) not null, company_name varchar(25) not null, first_name varchar(25) not null, last_name varchar(25) not null, email varchar(35) not null, address1 varchar(40) not null, address2 varchar(40) , city varchar(35) not null, state tinyint , zip varchar(12) not null, phone varchar(15) not null, mobile varchar(15) , creation_date date, last_login datetime, primary key (id), index(id, state) ); Just a note that the state was giving me problems (error said that I was trying to put in a string when it needed an int) so I removed it from the form. Any idea why this isn't working? What can I insert in my 'create' method so that I can see what the problem is? I need to learn how to debug these things myself so that I don't have to bother user groups like this one. Just a note that I can see the 'contents' of the @params array. It's not helping my debugging though. Thank you in advance.