Skip to content

Commit

Permalink
Fixed form helpers to query Model#id_before_type_cast instead of Mode…
Browse files Browse the repository at this point in the history
…l#id as a temporary workaround for Ruby 1.8.2 warnings #818 [DeLynn B]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@934 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information
dhh committed Mar 20, 2005
1 parent 1b93da3 commit 6cd3bda
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions actionpack/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*

* Fixed form helpers to query Model#id_before_type_cast instead of Model#id as a temporary workaround for Ruby 1.8.2 warnings #818 [DeLynn B]

* Fixed TextHelper#markdown to use blank? instead of empty? so it can deal with nil strings passed #814 [Johan Sörensen]

* Added TextHelper#simple_format as a non-dependency text presentation helper #814 [Johan Sörensen]
Expand Down
2 changes: 1 addition & 1 deletion actionpack/lib/action_view/helpers/form_helper.rb
Expand Up @@ -152,7 +152,7 @@ def initialize(object_name, method_name, template_object, local_binding = nil)
@object_name, @method_name = object_name, method_name
@template_object, @local_binding = template_object, local_binding
if @object_name.sub!(/\[\]$/,"")
@auto_index = @template_object.instance_variable_get("@#{Regexp.last_match.pre_match}").id
@auto_index = @template_object.instance_variable_get("@#{Regexp.last_match.pre_match}").id_before_type_cast
end
end

Expand Down
1 change: 1 addition & 0 deletions actionpack/test/template/form_helper_test.rb
Expand Up @@ -19,6 +19,7 @@ def setup
def @post.errors() Class.new{ def on(field) field == "author_name" end }.new end

def @post.id; 123; end
def @post.id_before_type_cast; 123; end

@post.title = "Hello World"
@post.author_name = ""
Expand Down

0 comments on commit 6cd3bda

Please sign in to comment.