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:???
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:
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.”
On 26 November 2010 23:54, JK [email protected] wrote:
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:???
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,
Zoltn
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs