This project is archived and is in readonly mode.
link_to_function and fields_for inside block - empty array in with_output_buffer error
Reported by Vincent | July 22nd, 2010 @ 05:56 AM | in 3.0.2
In Rails 3 beta 4:
def add_link(form_builder)
link_to_function 'add' do |page|
form_builder.fields_for :task, Task.new do |f|
...
end
end
end
causes
undefined method `encoding' for []:Array
actionpack (3.0.0.beta4) lib/action_view/helpers/capture_helper.rb:171:in `with_output_buffer'
Comments and changes to this ticket
-
Santiago Pastorino July 22nd, 2010 @ 03:52 PM
- Importance changed from to Low
Can you try it with master and try to do a test case? if not can you please upload an app with this code to make it easier for me to reproduce?.
Thanks. -
Vincent July 22nd, 2010 @ 04:24 PM
I tried with master last night. I will upload an app later tonight.
Thanks.
-
Vincent July 23rd, 2010 @ 05:17 AM
Here is the app. The erroneous code is in app/helpers/projects_helper.rb
-
Santiago Pastorino July 23rd, 2010 @ 07:25 AM
Vincent i've tried with the latest code from master and works ok.
Please try it again with the code from master and let me know. -
rorra July 24th, 2010 @ 10:03 PM
I've tried with the latest code from master and ruby 1.9.2 RC 2 and it gives me the same error
-
rorra July 24th, 2010 @ 11:36 PM
Ok, I got a way to reproduce the error in an easy way
link_to_function("Greet me!") do |page| content_tag :h1 do 'Hi' end end
-
Sebastian A. Espindola July 25th, 2010 @ 07:59 AM
I think I fixed the issue.
I made a modification on line 168 of capture_helper.rb to make sure that
output_helper responds to the encoding method before using it.
I've used Rorra's test case, and it passes fine.
I'm appending a patch. -
Santiago Pastorino July 25th, 2010 @ 09:55 AM
- Assigned user set to José Valim
- State changed from new to verified
- Milestone cleared.
rorra yeah confirmed, i was testing with 1.8.7 sorry. I see the issue happens on 1.9.2.
The solution of Sebastian is right for me. -
Sebastian A. Espindola July 25th, 2010 @ 03:27 PM
Right. This problem would only happen on 1.9.x, since now a string
is a collection of encoded data.
No other String implementations (AFAIK) respond to the encoding or force_encoding methods. -
Repository July 25th, 2010 @ 03:33 PM
(from [8d5b792e7dadf8b2f64b75b6fee51d15fde70699]) Fixed output_buffer encoding problem [#5179]
Signed-off-by: Santiago Pastorino santiago@wyeworks.com
Signed-off-by: José Valim jose.valim@gmail.com
http://github.com/rails/rails/commit/8d5b792e7dadf8b2f64b75b6fee51d... -
Carlos Antonio da Silva July 25th, 2010 @ 09:33 PM
I added a new patch updating the test added by this patch, asserting the content generated for link_to_function is ok. The current test has no assertion.
-
Repository July 25th, 2010 @ 10:00 PM
- State changed from verified to resolved
(from [751f89b8b28634cb237d1e47f33ddefaa13829dc]) Add assertion to link_to_function test with block and capture, and more expressive test name [#5179 state:resolved]
Signed-off-by: José Valim jose.valim@gmail.com
http://github.com/rails/rails/commit/751f89b8b28634cb237d1e47f33dde... -
rorra July 27th, 2010 @ 07:55 PM
Hey guys, when I first added the test patch to reproduce the error, it was just an ugly example, I didn't thought it was going to be committed into rails :P
Anyway, the current test doesn't put anything in the onclick attribute, and the
tag doesn't appears at all.
I just updated the test to actually expect a valid piece of js code in the onclick attribute
Thank you
-
Repository July 29th, 2010 @ 05:13 PM
(from [aa054c35f7809b57ecb105e485e4436d9fe37b1b]) link_to_function now expects a piece of javascript code for the onclick parameter
[#5179]
Signed-off-by: Santiago Pastorino santiago@wyeworks.com
http://github.com/rails/rails/commit/aa054c35f7809b57ecb105e485e443...
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>
People watching this ticket
Attachments
Referenced by
- 5179 link_to_function and fields_for inside block - empty array in with_output_buffer error (from [8d5b792e7dadf8b2f64b75b6fee51d15fde70699]) Fixed o...
- 5179 link_to_function and fields_for inside block - empty array in with_output_buffer error (from [751f89b8b28634cb237d1e47f33ddefaa13829dc]) Add ass...
- 5179 link_to_function and fields_for inside block - empty array in with_output_buffer error [#5179]