This project is archived and is in readonly mode.
link_to_function and fields_for inside block - empty array in with_output_buffer error
-
Santiago Pastorino
- 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
I tried with master last night. I will upload an app later tonight.
Thanks.
-
Vincent
Here is the app. The erroneous code is in app/helpers/projects_helper.rb
-
Santiago Pastorino
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
I've tried with the latest code from master and ruby 1.9.2 RC 2 and it gives me the same error
-
rorra
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
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
- 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
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
(from [8d5b792e7dadf8b2f64b75b6fee51d15fde70699]) Fixed output_buffer encoding problem [#5179 link_to_function and fields_for inside block - empty array in with_output_buf...]
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
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
- 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 link_to_function and fields_for inside block - empty array in with_output_buf... state:resolved]
Signed-off-by: José Valim jose.valim@gmail.com
http://github.com/rails/rails/commit/751f89b8b28634cb237d1e47f33dde... -
rorra
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
-
rorra
I wanted to say that the
<h1> tag doesn't appears at all:)
-
Repository
(from [aa054c35f7809b57ecb105e485e4436d9fe37b1b]) link_to_function now expects a piece of javascript code for the onclick parameter
[#5179 link_to_function and fields_for inside block - empty array in with_output_buf...]
Signed-off-by: Santiago Pastorino santiago@wyeworks.com
http://github.com/rails/rails/commit/aa054c35f7809b57ecb105e485e443...
