Created
January 23, 2017 22:35
-
-
Save mAlishera/a7f9c3fefe5249406ac498553da4b3fd to your computer and use it in GitHub Desktop.
timestamps in AR
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CreateUsers < ActiveRecord::Migration | |
def change | |
create_table :users do |t| | |
... | |
t.datetime 'inserted_at', null: false | |
t.datetime 'updated_at', null: false | |
end | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class User < ActiveRecord::Base | |
private | |
def timestamp_attributes_for_create | |
[:inserted_at] | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment