lib/action_view/renderer/partial_renderer.rb in actionpack-4.0.12 vs lib/action_view/renderer/partial_renderer.rb in actionpack-4.0.13.rc1

- old
+ new

@@ -345,11 +345,11 @@ @path = partial_path end end if as = options[:as] - raise_invalid_identifier(as) unless as.to_s =~ /\A[a-z_]\w*\z/ + raise_invalid_option_as(as) unless as.to_s =~ /\A[a-z_]\w*\z/ as = as.to_sym end if @path @variable, @variable_counter = retrieve_variable(@path, as) @@ -480,13 +480,21 @@ variable_counter = :"#{variable}_counter" if @collection [variable, variable_counter] end IDENTIFIER_ERROR_MESSAGE = "The partial name (%s) is not a valid Ruby identifier; " + - "make sure your partial name starts with a lowercase letter or underscore, " + + "make sure your partial name starts with underscore, " + "and is followed by any combination of letters, numbers and underscores." + OPTION_AS_ERROR_MESSAGE = "The value (%s) of the option `as` is not a valid Ruby identifier; " + + "make sure it starts with lowercase letter, " + + "and is followed by any combination of letters, numbers and underscores." + def raise_invalid_identifier(path) raise ArgumentError.new(IDENTIFIER_ERROR_MESSAGE % (path)) + end + + def raise_invalid_option_as(as) + raise ArgumentError.new(OPTION_AS_ERROR_MESSAGE % (as)) end end end