diff options
author | Piotr Sarnacki <drogus@gmail.com> | 2011-11-24 06:56:46 -0800 |
---|---|---|
committer | Piotr Sarnacki <drogus@gmail.com> | 2011-11-24 06:56:46 -0800 |
commit | 30cf3e16a079f833cf396ad9dfaa3a2d4652142d (patch) | |
tree | 239d46f6c8166da67e3e4b2ddd6a1b2bc306f45e /activemodel/lib | |
parent | a478389b7d70536f1629d080a50a9ecd87c005d0 (diff) | |
parent | dc39af0a9a998938a969b214554db624dcdd9c85 (diff) | |
download | rails-30cf3e16a079f833cf396ad9dfaa3a2d4652142d.tar.gz rails-30cf3e16a079f833cf396ad9dfaa3a2d4652142d.tar.bz2 rails-30cf3e16a079f833cf396ad9dfaa3a2d4652142d.zip |
Merge pull request #3746 from qoobaa/active-model-naming-with-anonymous-classes
make ActiveModel::Name fail gracefully with anonymous classes
Diffstat (limited to 'activemodel/lib')
-rw-r--r-- | activemodel/lib/active_model/naming.rb | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/activemodel/lib/active_model/naming.rb b/activemodel/lib/active_model/naming.rb index 2566920d63..953d24a3b2 100644 --- a/activemodel/lib/active_model/naming.rb +++ b/activemodel/lib/active_model/naming.rb @@ -12,6 +12,9 @@ module ActiveModel def initialize(klass, namespace = nil, name = nil) name ||= klass.name + + raise ArgumentError, "Class name cannot be blank. You need to supply a name argument when anonymous class given" if name.blank? + super(name) @unnamespaced = self.sub(/^#{namespace.name}::/, '') if namespace |