Forum: Ruby on Rails how to debug "save" error?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Vic (Guest)
on 2007-03-26 21:43
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:..

  SQL (0.000000)   BEGIN
  SQL (0.000000)   COMMIT
Jeff C. (Guest)
on 2007-03-26 22:41
(Received via mailing list)
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
Vic (Guest)
on 2007-03-26 22:46
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
This topic is locked and can not be replied to.