Commit e8fa0f50ff73883febe377838a85a22c276e2777
1 parent
d4733489
Exists in
master
and in
20 other branches
rails4: Remove activecord primary_key monkey patch
Showing
1 changed file
with
1 additions
and
6 deletions
Show diff stats
lib/noosfero/core_ext/active_record.rb
@@ -2,11 +2,6 @@ require 'active_record' | @@ -2,11 +2,6 @@ require 'active_record' | ||
2 | 2 | ||
3 | class ActiveRecord::Base | 3 | class ActiveRecord::Base |
4 | 4 | ||
5 | - # default primary key | ||
6 | - def self.primary_key | ||
7 | - @primary_key = 'id' if self.column_names.include? 'id' | ||
8 | - end | ||
9 | - | ||
10 | def self.postgresql? | 5 | def self.postgresql? |
11 | ActiveRecord::Base.connection.adapter_name == 'PostgreSQL' | 6 | ActiveRecord::Base.connection.adapter_name == 'PostgreSQL' |
12 | end | 7 | end |
@@ -68,7 +63,7 @@ class ActiveRecord::Base | @@ -68,7 +63,7 @@ class ActiveRecord::Base | ||
68 | end | 63 | end |
69 | 64 | ||
70 | ActiveRecord::Calculations.class_eval do | 65 | ActiveRecord::Calculations.class_eval do |
71 | - def count_with_distinct column_name=:id, options={} | 66 | + def count_with_distinct column_name=nil, options={} |
72 | distinct.count_without_distinct column_name, options | 67 | distinct.count_without_distinct column_name, options |
73 | end | 68 | end |
74 | alias_method_chain :count, :distinct | 69 | alias_method_chain :count, :distinct |