rails/rails — Issue #5126: form_for usign symbol or string conflict with ivars in same scope
Author: danielvlopes
Created: 2012-02-22 14:02:42+00:00
State: open

Hello,

I'm trying to use form_for to set the correct name for my fields without any active model object but instead, using a symbol. It works fine when there is no ivar with same name of the symbol in the same scope. After dig in Rails test suite I'm not sure if this is a desired behavior. This test exemplifies the problem:

```ruby
def test_form_for_without_object_and_with_an_ivar_using_same_name_of_symbol
@post = Object.new

form_for(:post, :html => { :id => 'create-post' }) do |f|
concat f.text_field(:title)
concat f.text_area(:body)
concat f.check_box(:secret)
end

expected = whole_form("/", "create-post") do
"" +
"Back to the hill and over it again!" +
"" +
""
end

assert_dom_equal expected, output_buffer
end
```
The return result will be undefined method title for post ivar.