Error when inserting row through script/console


#1

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 => Time.now, :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?


#2

@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
it
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?

-philip


#3

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.