I found the error. It was a logical error in my code! In order to get
the error condition I had:
dberror ||= issue.save
(once I got a true from the first iteration, it never did the second
save onwards)

I changed it to following and it works:
dberror &&= issue.save

I would still like to know if there is a way to run rails in a debug
mode to see the stack trace.
Thanks,
Anupam.

Hi,
Thanks for the pointers.
I haven’t overriden any of the default methods of the
ActiveRecord::Base class. I even tried to define them (validate*)
methods.
Yet, I get the same result, only one record is created.

I found the error. It was a logical error in my code! In order to get
the error condition I had:
dberror ||= issue.save
(once I got a true from the first iteration, it never did the second
save onwards)

I changed it to following and it works:
dberror &&= issue.save

The save method just returns true or false, so I’m not sure what you’re
gaining with this. The usual approach is to say:

if issue.save#do something
else
#…
end

I would still like to know if there is a way to run rails in a debug
mode to see the stack trace.

Rails has the concept of “run modes”: development, production and test.
While you are developing, you run in development mode (that’s the
default, so it’s probably what you are doing).

Rails logs to a log file with the name of the mode in the log directory.
So, if you tail development.log, you should see any stack traces,
queries, etc.

Also, if an exception is thrown while running in development mode, rails
should give you an error page in the browser with the stack trace.