Skip to content

Commit

Permalink
No need to check model_name anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
Rafael Mendonça França committed Aug 18, 2014
1 parent d2d8098 commit 8742bc9
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions activemodel/lib/active_model/naming.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8742bc9

Please sign in to comment.