diff options
author | Rémy Coutable <remy@rymai.me> | 2016-05-11 12:32:48 +0200 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-05-11 12:32:48 +0200 |
commit | 941301339dd8d1e282c3e225808875ef86b45f2b (patch) | |
tree | 34e22ec7bc23be157b46a489fc4c2f8ccad03814 /config/initializers | |
parent | e77a9a342e175c7274350ef6d655bde496eca778 (diff) | |
download | gitlab-ce-941301339dd8d1e282c3e225808875ef86b45f2b.tar.gz |
Remove Rails monkey-patches now that we're using Rails 4.2.6
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'config/initializers')
-rw-r--r-- | config/initializers/monkey_patch.rb | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/config/initializers/monkey_patch.rb b/config/initializers/monkey_patch.rb deleted file mode 100644 index 62b05a55285..00000000000 --- a/config/initializers/monkey_patch.rb +++ /dev/null @@ -1,48 +0,0 @@ -## This patch is from rails 4.2-stable. Remove it when 4.2.6 is released -## https://github.com/rails/rails/issues/21108 - -module ActiveRecord - module ConnectionAdapters - class AbstractMysqlAdapter < AbstractAdapter - # SHOW VARIABLES LIKE 'name' - def show_variable(name) - variables = select_all("select @@#{name} as 'Value'", 'SCHEMA') - variables.first['Value'] unless variables.empty? - rescue ActiveRecord::StatementInvalid - nil - end - - - # MySQL is too stupid to create a temporary table for use subquery, so we have - # to give it some prompting in the form of a subsubquery. Ugh! - def subquery_for(key, select) - subsubselect = select.clone - subsubselect.projections = [key] - - subselect = Arel::SelectManager.new(select.engine) - subselect.project Arel.sql(key.name) - # Materialized subquery by adding distinct - # to work with MySQL 5.7.6 which sets optimizer_switch='derived_merge=on' - subselect.from subsubselect.distinct.as('__active_record_temp') - end - end - end -end - -module ActiveRecord - module ConnectionAdapters - class MysqlAdapter < AbstractMysqlAdapter - ADAPTER_NAME = 'MySQL'.freeze - - # Get the client encoding for this database - def client_encoding - return @client_encoding if @client_encoding - - result = exec_query( - "select @@character_set_client", - 'SCHEMA') - @client_encoding = ENCODINGS[result.rows.last.last] - end - end - end -end |