expose Referable#non_referable_inspect
This commit is contained in:
parent
ec34b2d051
commit
f656d4ebc6
2 changed files with 5 additions and 9 deletions
|
@ -25,6 +25,11 @@ module Referable
|
||||||
to_reference(from_project)
|
to_reference(from_project)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
included do
|
||||||
|
alias_method :non_referable_inspect, :inspect
|
||||||
|
alias_method :inspect, :referable_inspect
|
||||||
|
end
|
||||||
|
|
||||||
def referable_inspect
|
def referable_inspect
|
||||||
if respond_to?(:id)
|
if respond_to?(:id)
|
||||||
"#<#{self.class.name} id:#{id} #{to_reference(full: true)}>"
|
"#<#{self.class.name} id:#{id} #{to_reference(full: true)}>"
|
||||||
|
@ -33,10 +38,6 @@ module Referable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def inspect
|
|
||||||
referable_inspect
|
|
||||||
end
|
|
||||||
|
|
||||||
module ClassMethods
|
module ClassMethods
|
||||||
# The character that prefixes the actual reference identifier
|
# The character that prefixes the actual reference identifier
|
||||||
#
|
#
|
||||||
|
|
|
@ -47,11 +47,6 @@ class User < ActiveRecord::Base
|
||||||
devise :lockable, :recoverable, :rememberable, :trackable,
|
devise :lockable, :recoverable, :rememberable, :trackable,
|
||||||
:validatable, :omniauthable, :confirmable, :registerable
|
: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!
|
# Override Devise::Models::Trackable#update_tracked_fields!
|
||||||
# to limit database writes to at most once every hour
|
# to limit database writes to at most once every hour
|
||||||
def update_tracked_fields!(request)
|
def update_tracked_fields!(request)
|
||||||
|
|
Loading…
Reference in a new issue