aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2005-11-13 22:21:19 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2005-11-13 22:21:19 +0000
commit44ca6f4b6203455703d00d82e1c5952c6d7402e7 (patch)
treea7c7a29605a6949cf0658889ccb20858da0ba4c7 /actionpack
parentb0c23e589f29319c4ff81a4d07257928d34f9510 (diff)
downloadrails-44ca6f4b6203455703d00d82e1c5952c6d7402e7.tar.gz
rails-44ca6f4b6203455703d00d82e1c5952c6d7402e7.tar.bz2
rails-44ca6f4b6203455703d00d82e1c5952c6d7402e7.zip
Only include builtin filters whose filenames match /^[a-z][a-z_]*_helper.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
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/CHANGELOG2
-rw-r--r--actionpack/lib/action_view/base.rb9
2 files changed, 6 insertions, 5 deletions
diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG
index 4c5f2b1e06..dcf038094b 100644
--- a/actionpack/CHANGELOG
+++ b/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| %>
diff --git a/actionpack/lib/action_view/base.rb b/actionpack/lib/action_view/base.rb
index 92eef11967..e5dea1bae2 100644
--- a/actionpack/lib/action_view/base.rb
+++ b/actionpack/lib/action_view/base.rb
@@ -157,13 +157,12 @@ module ActionView #: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