Forum: Ruby on Rails Error when inserting row through script/console

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Josh P. (Guest)
on 2007-02-16 05:37
I'm trying to follow a tutorial, and I'm trying to enter in some data to
the database through the script/console in the Terminal (OS X).  Here is
what I enter, and the error that follows:

account.expenses.create(:paid_on =>, :payable_to => 'Me',
:amount => 75.00)

=> #<Expense:0x24a4010 @new_record=false, @attributes={"account_id"=>5,
"payable_to"=>"Me", "id"=>4, "amount"=>75.0, "paid_on"=>Thu Feb 15
21:32:35 CST 2007}, @errors=#<ActiveRecord::Errors:0x24a2f94
@base=#<Expense:0x24a4010 ...>, @errors={}>>

Any ideas what might be going wrong here?
Philip H. (Guest)
on 2007-02-16 06:10
(Received via mailing list)
> @base=#<Expense:0x24a4010 ...>, @errors={}>>
> Any ideas what might be going wrong here?

Why do you think there's a problem?  Does the record not show up in the
database?  Cause the above output is what you would expect to get when
works...  unless I'm just not reading it right.  @errors is empty like
you'd expect and you haven't shown any actual error message that is
occuring.  What does your development.log show as far as SQL queries?

Josh P. (Guest)
on 2007-02-16 06:12
Yea, I just found that out from someone else.  I'm totally new to ruby
on rails, so seeing the word 'error' a couple times in the output just
made me think there was an error.  I've got a lot to learn yet...
Thanks for the response.
This topic is locked and can not be replied to.