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.
C33f49f806747e6b46c632430a855578?d=identicon&s=25 Vic (Guest)
on 2007-03-26 19: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
8217faf2bfdfa7daf10135d41ddd421e?d=identicon&s=25 Jeff Cohen (jeff)
on 2007-03-26 20:41
(Received via mailing list)
On Mar 26, 12:43 pm, Vic <rails-mailing-l...@andreas-s.net> 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
C33f49f806747e6b46c632430a855578?d=identicon&s=25 Vic (Guest)
on 2007-03-26 20:46
Thanks, looking at @item.errors uncovered the problem!!

Jeff Cohen wrote:
> On Mar 26, 12:43 pm, Vic <rails-mailing-l...@andreas-s.net> 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.