How to debug "save" error?


#1

How can I see why @item.save is failing? I checked debug.log but it is
not being helpful at all…
Is there any other way or log file? Thanks!!!

what debug.log says:…

e[4;35;1mSQL (0.000000)e[0m e[0mBEGINe[0m
e[4;36;1mSQL (0.000000)e[0m e[0;1mCOMMITe[0m


#2

On Mar 26, 12:43 pm, Vic removed_email_address@domain.invalid wrote:

How can I see why @item.save is failing? I checked debug.log but it is
not being helpful at all…
Is there any other way or log file? Thanks!!!

Perhaps validations are failing for your object?

Try

logger.debug @item.errors.full_messages

right after @item.save, and see if that leads anywhere helpful.

Jeff
softiesonrails.com


#3

Thanks, looking at @item.errors uncovered the problem!!

Jeff C. wrote:

On Mar 26, 12:43 pm, Vic removed_email_address@domain.invalid wrote:

How can I see why @item.save is failing? I checked debug.log but it is
not being helpful at all…
Is there any other way or log file? Thanks!!!

Perhaps validations are failing for your object?

Try

logger.debug @item.errors.full_messages

right after @item.save, and see if that leads anywhere helpful.

Jeff
softiesonrails.com