diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2017-08-17 10:18:38 +0000 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2017-08-17 10:18:38 +0000 |
commit | 3a3955731b5fa0e558b6907544b748b6647a6099 (patch) | |
tree | 9261edbcbd927976058db4a76778d8a89159294e | |
parent | db3289be55f5efe7523d2e8119f549b93c140b92 (diff) | |
parent | f656d4ebc6afeb193fb76454e2fd5c4ad7cbe851 (diff) | |
download | gitlab-ce-3a3955731b5fa0e558b6907544b748b6647a6099.tar.gz |
Merge branch 'dev.non-referable-inspect' into 'master'
expose Referable#non_referable_inspect
See merge request !13613
-rw-r--r-- | app/models/concerns/referable.rb | 9 | ||||
-rw-r--r-- | app/models/user.rb | 5 |
2 files changed, 5 insertions, 9 deletions
diff --git a/app/models/concerns/referable.rb b/app/models/concerns/referable.rb index 10f4be72016..78ac4f324e7 100644 --- a/app/models/concerns/referable.rb +++ b/app/models/concerns/referable.rb @@ -25,6 +25,11 @@ module Referable to_reference(from_project) end + included do + alias_method :non_referable_inspect, :inspect + alias_method :inspect, :referable_inspect + end + def referable_inspect if respond_to?(:id) "#<#{self.class.name} id:#{id} #{to_reference(full: true)}>" @@ -33,10 +38,6 @@ module Referable end end - def inspect - referable_inspect - end - module ClassMethods # The character that prefixes the actual reference identifier # diff --git a/app/models/user.rb b/app/models/user.rb index 0e2654ff757..02c3ab6654b 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -47,11 +47,6 @@ class User < ActiveRecord::Base devise :lockable, :recoverable, :rememberable, :trackable, :validatable, :omniauthable, :confirmable, :registerable - # devise overrides #inspect, so we manually use the Referable one - def inspect - referable_inspect - end - # Override Devise::Models::Trackable#update_tracked_fields! # to limit database writes to at most once every hour def update_tracked_fields!(request) |