Permalink
Browse files

No need to check model_name anymore

  • Loading branch information...
1 parent d2d8098 commit 8742bc9d5e030b4ac6119d61a163ba72c2e7e380 Rafael Mendonça França committed Aug 18, 2014
Showing with 2 additions and 4 deletions.
  1. +2 −4 activemodel/lib/active_model/naming.rb
@@ -304,12 +304,10 @@ def self.param_key(record_or_class)
end
def self.model_name_from_record_or_class(record_or_class) #:nodoc:
- if record_or_class.respond_to?(:model_name)
- record_or_class.model_name
- elsif record_or_class.respond_to?(:to_model)
+ if record_or_class.respond_to?(:to_model)
record_or_class.to_model.model_name
else
- record_or_class.class.model_name
+ record_or_class.model_name
end
end
private_class_method :model_name_from_record_or_class

0 comments on commit 8742bc9

Please sign in to comment.