Adding date into entries when I do scaffolding [beginner question]

So I would like to add time as an attribute of my Submission using scaffolding. What is the code I should use to replace ??? part?

rails generate scaffold Submission title:string describtion:text email:string category:string time:???

well, you should probably check this out:

http://api.rubyonrails.org/classes/ActiveRecord/Timestamp.html

It says: "Active Record automatically timestamps create and update operations if the table has fields named created_at/created_on or updated_at/updated_on."

I would advise against a field name of time, it is in the reserved word list at http://wiki.rubyonrails.org/rails/pages/ReservedWords. In practice you may be ok with lower case time but I would still advise against it.

If you need more than the default created_at and updated_at fields provided by rails then you can use the :datetime column type.

Colin

Hello,

time:date or time:datetime, depends on which type of data do you want to hold in your database.

Check also how to create a migration whihc change your model and database structure:

Preferabyl go through a tutorial, you wwill know the differences between generators also, now only scaffolding. And check the files which created by scaffold generator.

cheers, Zoltán