# Error when inserting row through script/console

**URL:** <https://www.ruby-forum.com/t/error-when-inserting-row-through-script-console/85767>\
**Category:** Rails\
**Created:** [February 16, 2007, 4:37am UTC](https://www.ruby-forum.com/t/error-when-inserting-row-through-script-console/85767 "2007-02-16T04:37:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jpigford](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b5a626/32.png) [@jpigford](https://www.ruby-forum.com/u/jpigford)\
**Post date:** [February 16, 2007, 4:37am UTC](https://www.ruby-forum.com/t/error-when-inserting-row-through-script-console/85767/1 "2007-02-16T04:37:38Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![jpigford](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b5a626/32.png) [@jpigford](https://www.ruby-forum.com/u/jpigford)\
**Post date:** [February 16, 2007, 5:10am UTC](https://www.ruby-forum.com/t/error-when-inserting-row-through-script-console/85767/2 "2007-02-16T05:10:47Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jpigford](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b5a626/32.png) [@jpigford](https://www.ruby-forum.com/u/jpigford)\
**Post date:** [February 16, 2007, 5:12am UTC](https://www.ruby-forum.com/t/error-when-inserting-row-through-script-console/85767/3 "2007-02-16T05:12:40Z")

</div>

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.
