aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib
diff options
context:
space:
mode:
authorYuki Nishijima <mail@yukinishijima.net>2014-06-22 19:06:44 -0700
committerYuki Nishijima <mail@yukinishijima.net>2014-06-22 19:14:25 -0700
commit10adc2ee90c34003edb5850b63c6cae321c09008 (patch)
tree97f8f3d5a8fafc2f13c3047cbd23ba62385d41cf /activemodel/lib
parent04b6ae4d186195008b7801df19ebba295f042288 (diff)
downloadrails-10adc2ee90c34003edb5850b63c6cae321c09008.tar.gz
rails-10adc2ee90c34003edb5850b63c6cae321c09008.tar.bz2
rails-10adc2ee90c34003edb5850b63c6cae321c09008.zip
Delegate #model_name method to self.class
Diffstat (limited to 'activemodel/lib')
-rw-r--r--activemodel/lib/active_model/naming.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/activemodel/lib/active_model/naming.rb b/activemodel/lib/active_model/naming.rb
index 5219de2606..8cf1a191f4 100644
--- a/activemodel/lib/active_model/naming.rb
+++ b/activemodel/lib/active_model/naming.rb
@@ -214,6 +214,12 @@ module ActiveModel
# is required to pass the Active Model Lint test. So either extending the
# provided method below, or rolling your own is required.
module Naming
+ def self.extended(base) #:nodoc:
+ base.class_eval do
+ delegate :model_name, to: :class
+ end
+ end
+
# Returns an ActiveModel::Name object for module. It can be
# used to retrieve all kinds of naming-related information
# (See ActiveModel::Name for more information).