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 KeyExtractor | |
def self.extract(key_spec, source) | |
new(key_spec.split("."), source).extract | |
end | |
def self.extract_array(key_spec, source) | |
extract(key_spec, source) || [] | |
end | |
def initialize(key_parts, source) |
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
require 'rails' | |
require 'action_controller/railtie' | |
class TestApp < Rails::Application | |
config.root = File.dirname(__FILE__) | |
config.session_store :cookie_store, key: 'cookie_store_key' | |
config.secret_token = 'secret_token' | |
config.secret_key_base = 'secret_key_base' | |
config.logger = Logger.new($stdout) |
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
#!/bin/sh | |
# This script will setup Evm (Emacs Version Manager) and Cask on | |
# Travis to use for Emacs Lisp testing. | |
# | |
# In .travis.yml, add this: | |
# | |
# - curl -fsSkL https://gist.github.com/rejeep/7736123/raw > travis.sh && source ./travis.sh | |
# | |
# Emacs 24.3 is installed in the above script because Cask requires |
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
#!/bin/sh | |
# This script will setup Evm and Cask on Travis to use for Emacs Lisp testing. | |
# | |
# In .travis.yml, add Evm and Cask to PATH. | |
# | |
# - export PATH="/home/travis/.cask/bin:$PATH" | |
# - export PATH="/home/travis/.evm/bin:$PATH" | |
sudo mkdir /usr/local/evm |
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
[33m0463698[m[32m (HEAD, 4-0-stable)[m Merge pull request #12646 from severin/polymorphic_belongs_to_touch [31m[Yves Senn][m [36m[27 seconds ago][m | |
diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md | |
index 852be57..adc7003 100644 | |
--- a/activerecord/CHANGELOG.md | |
+++ b/activerecord/CHANGELOG.md | |
@@ -1,3 +1,17 @@ | |
+* Polymorphic belongs_to associations with the `touch: true` option set update the timestamps of | |
+ the old and new owner correctly when moved between owners of different types. | |
+ |
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
require 'active_record' | |
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 :event_kinds do |t| |
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
diff --git a/activerecord/lib/active_record/log_subscriber.rb b/activerecord/lib/active_record/log_subscriber.rb | |
index 927fbab..3100638 100644 | |
--- a/activerecord/lib/active_record/log_subscriber.rb | |
+++ b/activerecord/lib/active_record/log_subscriber.rb | |
@@ -22,6 +22,7 @@ module ActiveRecord | |
def render_bind(column, value) | |
if column | |
+ value = value[:value] if value.is_a?(Hash) | |
if column.binary? |
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
diff --git a/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb b/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb | |
index 41a4718..88c9494 100755 | |
--- a/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb | |
+++ b/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb | |
@@ -559,7 +559,7 @@ module ActiveRecord | |
def set_field_encoding field_name | |
field_name.force_encoding(client_encoding) | |
if internal_enc = Encoding.default_internal | |
- field_name = field_name.encoding(internal_enc) | |
+ field_name = field_name.encode!(internal_enc) |
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
1) Failure: | |
BasicsTest#test_preserving_time_objects_with_time_with_zone_conversion_to_default_timezone_local [/Users/senny/Projects/rails/activerecord/test/cases/base_test.rb:279]: | |
--- expected | |
+++ actual | |
@@ -1 +1 @@ | |
-[0, 0, 1, 1, 1, 2000, 6, 1, false, "EST"] | |
+[0, 0, 0, 1, 1, 2000, 6, 1, false, "CST"] | |
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
def test_timestamp_with_zone_values_without_rails_time_zone_support | |
p @connection.execute('SHOW TIME ZONE', 'SCHEMA').first["TimeZone"] | |
with_timezone_config default: :local, aware_attributes: false do | |
@connection.reconnect! | |
@connection.execute("SET time zone 'America/Jamaica'", 'SCHEMA') | |
@first_timestamp_with_zone = PostgresqlTimestampWithZone.find(1) | |
assert_equal Time.utc(2010,1,1, 11,0,0), @first_timestamp_with_zone.time | |
assert_instance_of Time, @first_timestamp_with_zone.time | |
p @connection.execute('SHOW TIME ZONE', 'SCHEMA').first["TimeZone"] |