Created
October 8, 2013 14:11
-
-
Save roman-zaharenkov/6885322 to your computer and use it in GitHub Desktop.
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
| module TimestampsPatch | |
| extend ActiveSupport::Concern | |
| included do | |
| remove_method :timestamps | |
| end | |
| # Monkey patch: make timestamps not-nullable by default. | |
| def timestamps(*args) | |
| options = args.extract_options! | |
| options.reverse_merge!({ :null => false }) | |
| column(:created_at, :datetime, options) | |
| column(:updated_at, :datetime, options) | |
| end | |
| end | |
| module ModelToIntegerConverter | |
| def to_i | |
| self.id.to_i | |
| end | |
| end | |
| ActiveRecord::ConnectionAdapters::TableDefinition.send(:include, TimestampsPatch) | |
| ActiveRecord::ConnectionAdapters::Table.send(:include, TimestampsPatch) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment