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

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.
A1f57753b4b223604304e49c0e23bb1d?d=identicon&s=25 Josh P. (prattski)
on 2007-02-16 04: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 => 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?
2f9a03aa0fcfe945229cb6126eda2cb2?d=identicon&s=25 Philip Hallstrom (Guest)
on 2007-02-16 05: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
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
A1f57753b4b223604304e49c0e23bb1d?d=identicon&s=25 Josh P. (prattski)
on 2007-02-16 05: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.