Hi. I amn just upgrading a project from 2.3.12 to 3.0.11. I have come pretty long, my unit tests succeeds, but my functional tests also tests the views. There I experience that code like <%= form_for(@order, :html => {:multipart => true}) do |f| %> <% end %> renders the content of the block twice, that means the stuff between the do and end renders twive, not the formtag itself. And yes it is intentionally that I use ''<%='' as this is how it should be in Rails 3. I have tried to put a debug statement like <%= form_for(@order, :html => {:multipart => true}) do |f| %> <% debugger %> <% end %> That is only hit once... So somehow the output is buffered, and the code block is apparently not invoked twice, just outputted twice. Does anyone have a clue on why this happens? or where I should dig further. Jarl -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
On 6 June 2012 12:44, Jarl Friis <jarl@softace.dk> wrote:> Hi. > > I amn just upgrading a project from 2.3.12 to 3.0.11. > > I have come pretty long, my unit tests succeeds, but my functional > tests also tests the views. There I experience that code like > <%= form_for(@order, :html => {:multipart => true}) do |f| %> > <% end %> > > renders the content of the block twice, that means the stuff between > the do and end renders twive, not the formtag itself. > > And yes it is intentionally that I use ''<%='' as this is how it should > be in Rails 3. I have tried to put a debug statement like > <%= form_for(@order, :html => {:multipart => true}) do |f| %> > <% debugger %> > <% end %> > > That is only hit once... So somehow the output is buffered, and the > code block is apparently not invoked twice, just outputted twice.Does this only happen when running tests (if not then why mention the tests in the first place) or do you see it in the web browser when you go to the page. Is it only one form that is doing this or are you seeing it in multiple places. If you replace the contents of the form with just some simple text do you see it in the browser twice then? Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
This seems like a discussion better suited on rubyonrails-talk. I don''t see how it pertains to the core of the framework. On Wednesday, 6 June 2012 at 9:44 PM, Jarl Friis wrote:> Hi. > > I amn just upgrading a project from 2.3.12 to 3.0.11. > > I have come pretty long, my unit tests succeeds, but my functional > tests also tests the views. There I experience that code like > <%= form_for(@order, :html => {:multipart => true}) do |f| %> > <% end %> > > renders the content of the block twice, that means the stuff between > the do and end renders twive, not the formtag itself. > > And yes it is intentionally that I use ''<%='' as this is how it should > be in Rails 3. I have tried to put a debug statement like > <%= form_for(@order, :html => {:multipart => true}) do |f| %> > <% debugger %> > <% end %> > > That is only hit once... So somehow the output is buffered, and the > code block is apparently not invoked twice, just outputted twice. > > Does anyone have a clue on why this happens? or where I should dig further. > > Jarl > > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. > To post to this group, send email to rubyonrails-core@googlegroups.com (mailto:rubyonrails-core@googlegroups.com). > To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com (mailto:rubyonrails-core+unsubscribe@googlegroups.com). > For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
I don''t know if this is the problem you''re having, but does the form code in question use fields_for? If so, we found there was a regression with that - kuahyeow fixed it in https://github.com/willbryant/rails/commit/1b7656f3b391ddb5dd227d3904d03812b5aa2188 (test coverage added in https://github.com/willbryant/rails/commit/1879760a26f20d9cac23e8f570b9fc81b4b5608f, merged along with other fixes to https://github.com/willbryant/rails/tree/3-0-stable). On 6/06/2012, at 23:44 , Jarl Friis wrote:> Hi. > > I amn just upgrading a project from 2.3.12 to 3.0.11. > > I have come pretty long, my unit tests succeeds, but my functional > tests also tests the views. There I experience that code like > <%= form_for(@order, :html => {:multipart => true}) do |f| %> > <% end %> > > renders the content of the block twice, that means the stuff between > the do and end renders twive, not the formtag itself. > > And yes it is intentionally that I use ''<%='' as this is how it should > be in Rails 3. I have tried to put a debug statement like > <%= form_for(@order, :html => {:multipart => true}) do |f| %> > <% debugger %> > <% end %> > > That is only hit once... So somehow the output is buffered, and the > code block is apparently not invoked twice, just outputted twice. > > Does anyone have a clue on why this happens? or where I should dig further. > > Jarl > > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. > To post to this group, send email to rubyonrails-core@googlegroups.com. > To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en. >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
It happens also in development, the "test" was just some background story (sorry)... It happens to more or less all my forms. If I replace the whole do block with just <h1>Hello</h1>, then things works as expected (thanks for the tip, Colin). It seems like my submit button that looks like this: <%= f.submit_button :class => ''button'' do %> <span>Create</span> <% end %> is the code that causes the problems. I have code that uses f.fields_for but that apparently works fine as long as the the submit button using the block style is removed. I now see that the submit_button mehtod is a helper that I wrote myself (I will debug that, and make it Rails3 compliant), thanks for the help to all of you. Jarl 2012/6/6 Will Bryant <will.bryant@gmail.com>:> I don''t know if this is the problem you''re having, but does the form code in question use fields_for? > > If so, we found there was a regression with that - kuahyeow fixed it in https://github.com/willbryant/rails/commit/1b7656f3b391ddb5dd227d3904d03812b5aa2188 (test coverage added in https://github.com/willbryant/rails/commit/1879760a26f20d9cac23e8f570b9fc81b4b5608f, merged along with other fixes to https://github.com/willbryant/rails/tree/3-0-stable). > > > On 6/06/2012, at 23:44 , Jarl Friis wrote: > >> Hi. >> >> I amn just upgrading a project from 2.3.12 to 3.0.11. >> >> I have come pretty long, my unit tests succeeds, but my functional >> tests also tests the views. There I experience that code like >> <%= form_for(@order, :html => {:multipart => true}) do |f| %> >> <% end %> >> >> renders the content of the block twice, that means the stuff between >> the do and end renders twive, not the formtag itself. >> >> And yes it is intentionally that I use ''<%='' as this is how it should >> be in Rails 3. I have tried to put a debug statement like >> <%= form_for(@order, :html => {:multipart => true}) do |f| %> >> <% debugger %> >> <% end %> >> >> That is only hit once... So somehow the output is buffered, and the >> code block is apparently not invoked twice, just outputted twice. >> >> Does anyone have a clue on why this happens? or where I should dig further. >> >> Jarl >> >> -- >> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. >> To post to this group, send email to rubyonrails-core@googlegroups.com. >> To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. >> For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en. >> > > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. > To post to this group, send email to rubyonrails-core@googlegroups.com. > To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en. >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.