Forum: Ruby on Rails Amended: Rails console, saving objects

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.
60c421971b231beb5a28b9ea458cf812?d=identicon&s=25 Raistlin Majere (Guest)
on 2008-10-06 04:39
(Received via mailing list)
I was reading a book and following the instructions in it.

>> class Story < ActiveRecord::Base; end
=> nil
>> story = Story.new
=> #<Story id: nil, name: nil, url: nil, created_at: nil, updated_at:
nil>
>> story.class
=> Story(id: integer, name: string, link: string, created_at:
datetime, updated_at: datetime)

I do not remember me asking for id, name, link or url, created_at and
updated_at. Is there a way to check if I asked?

I do know if I typed craeted_at instead of created_at or updetad_at
instead of updated_at. Is there a way to check whether I typed it
right or wrong?

From the Rails console, I had to create a story class, one instance of
it and save the object, but I created two, so I got a 2 output for a
story.id input. How do I remove the second object from the database?
81b61875e41eaa58887543635d556fca?d=identicon&s=25 Frederick Cheung (Guest)
on 2008-10-06 09:40
(Received via mailing list)
On Oct 6, 3:39 am, Raistlin Majere <pedbe...@gmail.com> wrote:
> datetime, updated_at: datetime)
>
> I do not remember me asking for id, name, link or url, created_at and
> updated_at. Is there a way to check if I asked?
>
Well Rails didn't make it up for you. The book probably had you create
a migration with those columns.

Fred
This topic is locked and can not be replied to.