-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
62 additions
and
63 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,41 @@ | ||
language: ruby | ||
sudo: false | ||
|
||
cache: | ||
bundler: true | ||
|
||
rvm: | ||
- 2.3.3 | ||
- 2.4.0 | ||
- 2.3.4 | ||
- 2.4.1 | ||
|
||
env: | ||
- RAILS_VERSION=v5.0.1 | ||
|
||
cache: | ||
bundler: true | ||
directories: | ||
- /home/travis/.rvm/gems | ||
matrix: | ||
- RAILS_VERSION=v5.1.0 GEM=ar:mysql2 | ||
- RAILS_VERSION=v5.1.0 GEM=ar:sqlite3 | ||
- RAILS_VERSION=v5.1.0 GEM=ar:postgresql | ||
|
||
addons: | ||
postgresql: "9.4" | ||
|
||
before_install: | ||
- unset BUNDLE_GEMFILE | ||
- gem update --system | ||
- gem update bundler | ||
|
||
install: | ||
- bundle install --jobs=3 --retry=3 | ||
- git clone https://github.com/rails/rails.git ~/build/rails | ||
|
||
before_script: | ||
- pushd ~/build/rails | ||
- git checkout $RAILS_VERSION | ||
- sed -i "/require 'support\/connection'/a \$LOAD_PATH.unshift\(File.expand_path\('~\/build\/malomalo\/activerecord-cached_at\/lib'\)\)\nrequire 'cached_at/base'\nrequire 'cached_at/helpers'" ~/build/rails/activerecord/test/cases/helper.rb | ||
- sed -i "s/Gem.ruby, '-w'/Gem.ruby, '-w0'/" ~/build/rails/activerecord/Rakefile | ||
- sed -i "s/t.warning = true/t.warning = false/g" ~/build/rails/activerecord/Rakefile | ||
- sed -i "/require 'support\/connection'/a \$LOAD_PATH.unshift\(File.expand_path\('~\/build\/malomalo\/activerecord-cached_at\/lib'\)\)\nrequire 'cached_at'" ~/build/rails/activerecord/test/cases/helper.rb | ||
- cat ~/build/rails/Gemfile | ||
- "sed -i \"/group :db do/a gem 'activerecord-cached_at', require: false, path: File.expand_path\\('~\\/build\\/malomalo\\/activerecord-cached_at'\\)\" ~/build/rails/Gemfile" | ||
- "sed -i \"/group :db do/a gem 'activerecord-cached_at', require: 'cached_at', path: File.expand_path\\('~\\/build\\/malomalo\\/activerecord-cached_at'\\)\" ~/build/rails/Gemfile" | ||
- cat ~/build/rails/Gemfile | ||
- bundle install --jobs=3 --retry=3 | ||
- createdb activerecord_unittest | ||
- createdb activerecord_unittest2 | ||
- mysql -e "create database IF NOT EXISTS activerecord_unittest DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci;" | ||
- mysql -e "create database IF NOT EXISTS activerecord_unittest2 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci;" | ||
- gem environment gempath | ||
- popd | ||
- bundle install --jobs=3 --retry=3 | ||
- gem environment gempath | ||
|
||
script: bundle exec rake test && cd ~/build/rails/activerecord && bundle exec rake test --verbose | ||
script: | ||
- bundle exec rake test | ||
- cd ~/build/rails && ci/travis.rb |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,4 @@ | ||
source "https://rubygems.org" | ||
|
||
gem 'json', github: 'flori/json', branch: 'v1.8' | ||
|
||
# Specify your gem's dependencies in sunstone.gemspec | ||
gemspec |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,22 @@ | ||
module ActiveRecord | ||
module Timestamp | ||
|
||
private | ||
module CachedAt | ||
module Timestamp | ||
extend ActiveSupport::Concern | ||
|
||
class_methods do | ||
private | ||
|
||
def timestamp_attributes_for_update | ||
[:updated_at, :cached_at] | ||
end | ||
def timestamp_attributes_for_update | ||
['updated_at', 'cached_at'] | ||
end | ||
|
||
def timestamp_attributes_for_create | ||
['created_at', 'udpated_at', 'cached_at'] + column_names.select{|c| c.end_with?('_cached_at') } | ||
end | ||
|
||
def timestamp_attributes_for_create | ||
[:created_at, :udpated_at, :cached_at] + self.class.column_names.select{|c| c.end_with?('_cached_at') }.map(&:to_sym) | ||
end | ||
end | ||
|
||
end | ||
end | ||
end | ||
|
||
ActiveRecord::Base.include(ActiveRecord::CachedAt::Timestamp) |