Skip to content

Commit

Permalink
Endpoint.generate_api_method: detect method_name collision on MRI 1.8…
Browse files Browse the repository at this point in the history
….7-p370
  • Loading branch information
gruis committed Nov 1, 2012
1 parent 380d7ce commit 0e0a94f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/grape/endpoint.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class << self
# @return [Proc]
# @raise [NameError] an instance method with the same name already exists
def generate_api_method(method_name, &block)
if instance_methods.include?(method_name.to_sym)
if instance_methods.include?(method_name.to_sym) || instance_methods.include?(method_name.to_s)
raise NameError.new("method #{method_name.inspect} already exists and cannot be used as an unbound method name")
end
define_method(method_name, &block)
Expand Down

0 comments on commit 0e0a94f

Please sign in to comment.