I recreate the steps in this rail guide: http://www.youtube.com/watch?v=tUH1hewXnC0
If you are looking for 7:35, you will see the block_form that the user created. When I add this code and view the page in the browser, the page displays fine, but there is no html where the form should be - even empty tags. I confirmed that this is not a problem with the lack of migration or browser browser.
I simplified the problem and now my show.html.erb template file is simple:
<% form_for @post do |f| %> testing <% debugger %> <% end %> <% for i in 0..5 %> <%= i %> <% end %>
(The second block should make sure that the rendering works)
Html output:
... bunch of header stuff here ... <body> 0 1 2 3 4 5 </body> </html>
"testing" cannot be displayed as part of html.
I have included this debugger line to use the debugger game with the rails -debugger server. Using this, it will reach me:
[196, 205] in /Users/Ben/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/actionpack-4.0.0/lib/action_view/helpers/capture_helper.rb 196 buf = ActionView::OutputBuffer.new 197 buf.force_encoding(output_buffer.encoding) if output_buffer 198 end 199 self.output_buffer, old_buffer = buf, output_buffer 200 yield => 201 output_buffer 202 ensure 203 self.output_buffer = old_buffer 204 end 205 (rdb:48) p output_buffer " testing\n"
So form_for is started, but not delivered until the html exits in some way. (why am I not going to show you that I am properly initializing @post.)
I can't find mention of similar issues on the Internet, but I probably just didn't look for the right things. Any ideas?
ruby-on-rails ruby-on-rails-4 form-for
Ben wheeler
source share