Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Only include builtin filters whose filenames match /^[a-z][a-z_]*_hel…

…per.rb$/ to avoid including operating system metadata such as ._foo_helper.rb. References #2855.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3007 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
commit 44ca6f4b6203455703d00d82e1c5952c6d7402e7 1 parent b0c23e5
@jeremy jeremy authored
Showing with 6 additions and 5 deletions.
  1. +2 −0  actionpack/CHANGELOG
  2. +4 −5 actionpack/lib/action_view/base.rb
View
2  actionpack/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Only include builtin filters whose filenames match /^[a-z][a-z_]*_helper.rb$/ to avoid including operating system metadata such as ._foo_helper.rb. #2855 [court3nay@gmail.com]
+
* Added FormHelper#form_for and FormHelper#fields_for that makes it easier to work with forms for single objects also if they don't reside in instance variables [DHH]. Examples:
<% form_for :person => @person, :url => { :action => "update" } do |f| %>
View
9 actionpack/lib/action_view/base.rb
@@ -157,13 +157,12 @@ module CompiledTemplates #:nodoc:
class ObjectWrapper < Struct.new(:value) #:nodoc:
end
-
+
def self.load_helpers(helper_dir)#:nodoc:
Dir.foreach(helper_dir) do |helper_file|
- next unless helper_file =~ /_helper.rb$/
- require helper_dir + helper_file
- helper_module_name = helper_file.capitalize.gsub(/_([a-z])/) { |m| $1.capitalize }[0..-4]
-
+ next unless helper_file =~ /^([a-z][a-z_]*_helper).rb$/
+ require File.join(helper_dir, $1)
+ helper_module_name = $1.camelize
class_eval("include ActionView::Helpers::#{helper_module_name}") if Helpers.const_defined?(helper_module_name)
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.