Timestamps arent necessary

Whenever we create models in rails, we get a migration where timestamps are added to it. I accepted it as a rle of thumb till a day I was required to wrap my classes around a database in which the tab;es dd not have time stamp fields created_at and updated_at

Well then I tried the following piece of code rails g model tweet content:text and modified its migration so that it looks as floows

Look at it, it has no timestamps in it. I ran the migration and tried this code on the rails console

And it worked, proving Timestamps aren’t necessary. But its better to have them

Advertisements

, ,

  1. Timestamps arent necessary | Karthikeyan's Blog

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: