aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib/active_model
diff options
context:
space:
mode:
Diffstat (limited to 'activemodel/lib/active_model')
-rw-r--r--activemodel/lib/active_model/naming.rb5
-rw-r--r--activemodel/lib/active_model/observing.rb6
-rw-r--r--activemodel/lib/active_model/secure_password.rb2
-rw-r--r--activemodel/lib/active_model/version.rb2
4 files changed, 7 insertions, 8 deletions
diff --git a/activemodel/lib/active_model/naming.rb b/activemodel/lib/active_model/naming.rb
index 74708692af..4c1a82f413 100644
--- a/activemodel/lib/active_model/naming.rb
+++ b/activemodel/lib/active_model/naming.rb
@@ -7,8 +7,9 @@ module ActiveModel
attr_reader :singular, :plural, :element, :collection, :partial_path, :route_key, :param_key, :i18n_key
alias_method :cache_key, :collection
- def initialize(klass, namespace = nil)
- super(klass.name)
+ def initialize(klass, namespace = nil, name = nil)
+ name ||= klass.name
+ super(name)
@unnamespaced = self.sub(/^#{namespace.name}::/, '') if namespace
@klass = klass
diff --git a/activemodel/lib/active_model/observing.rb b/activemodel/lib/active_model/observing.rb
index 4682ae07ef..d48f2e8a1f 100644
--- a/activemodel/lib/active_model/observing.rb
+++ b/activemodel/lib/active_model/observing.rb
@@ -71,9 +71,7 @@ module ActiveModel
# Notify list of observers of a change.
def notify_observers(*arg)
- for observer in observer_instances
- observer.update(*arg)
- end
+ observer_instances.each { |observer| observer.update(*arg) }
end
# Total number of observers.
@@ -127,7 +125,7 @@ module ActiveModel
#
# class CommentObserver < ActiveModel::Observer
# def after_save(comment)
- # Notifications.deliver_comment("admin@do.com", "New comment was posted", comment)
+ # Notifications.comment("admin@do.com", "New comment was posted", comment).deliver
# end
# end
#
diff --git a/activemodel/lib/active_model/secure_password.rb b/activemodel/lib/active_model/secure_password.rb
index ee94ad66cf..63380d6ffd 100644
--- a/activemodel/lib/active_model/secure_password.rb
+++ b/activemodel/lib/active_model/secure_password.rb
@@ -30,7 +30,7 @@ module ActiveModel
# User.find_by_name("david").try(:authenticate, "notright") # => nil
# User.find_by_name("david").try(:authenticate, "mUc3m00RsqyRe") # => user
def has_secure_password
- attr_reader :password
+ attr_reader :password
validates_confirmation_of :password
validates_presence_of :password_digest
diff --git a/activemodel/lib/active_model/version.rb b/activemodel/lib/active_model/version.rb
index 68c138da84..09684ac4df 100644
--- a/activemodel/lib/active_model/version.rb
+++ b/activemodel/lib/active_model/version.rb
@@ -3,7 +3,7 @@ module ActiveModel
MAJOR = 3
MINOR = 1
TINY = 0
- PRE = "beta1"
+ PRE = "rc1"
STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
end