Skip to content

Instantly share code, notes, and snippets.

@prathamesh-sonpatki
Created September 16, 2016 13:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save prathamesh-sonpatki/1c82c0a86d1ca171b086324d41af8491 to your computer and use it in GitHub Desktop.
Save prathamesh-sonpatki/1c82c0a86d1ca171b086324d41af8491 to your computer and use it in GitHub Desktop.
begin
require "bundler/inline"
rescue LoadError => e
$stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler"
raise e
end
gemfile(true) do
source "https://rubygems.org"
gem "rails", github: 'rails/rails' # path: "/Users/prathamesh/Projects/sources/rails"
gem "sqlite3"
end
require "active_support"
require "active_record"
require "active_model"
require "minitest/autorun"
require "logger"
# This connection will do for database-independent bug reports.
ActiveRecord::Base.establish_connection(adapter: "sqlite3", database: ":memory:")
ActiveRecord::Base.logger = Logger.new(STDOUT)
ActiveRecord::Schema.define do
create_table :posts, force: true do |t|
t.datetime :modified_date
t.datetime :create_date
end
end
class Post < ActiveRecord::Base
alias_attribute :updated_at, :modified_date
alias_attribute :created_at, :create_date
end
class BugTest < ActiveSupport::TestCase
def test_association_stuff
post = Post.create! modified_date: DateTime.current
assert_not_equal "posts/1", post.cache_key
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment