From 0e0a94f6de1c664b6e7f90066982ea1a024f3f51 Mon Sep 17 00:00:00 2001 From: Caleb Crane Date: Thu, 1 Nov 2012 11:42:33 +0900 Subject: [PATCH] Endpoint.generate_api_method: detect method_name collision on MRI 1.8.7-p370 --- lib/grape/endpoint.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/grape/endpoint.rb b/lib/grape/endpoint.rb index 4413f75c5b..d2e16f8d2f 100644 --- a/lib/grape/endpoint.rb +++ b/lib/grape/endpoint.rb @@ -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)