I have always assumed that when using form_for in erb one should use <%= form_for ..... %> However having done some tests it appears that it works identically without the ''='' so <% form_for ... %> is ok. Can anyone explain this? I thought that without the ''='' the code would be run but the result would not be injected into the html. I appear to be wrong however. Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Jan 7, 11:39 am, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> I have always assumed that when using form_for in erb one should use > <%= form_for ..... %> > However having done some tests it appears that it works identically > without the ''='' so > <% form_for ... %> is ok. > > Can anyone explain this? I thought that without the ''='' the code > would be run but the result would not be injected into the html. I > appear to be wrong however.if you use <%= then when erb compiles your template it automatically appends the result of the expression to its output buffer. If you use <% then you can still call concat to do that yourself. This was a bit confusing - in rails 3 you use <%= for form_for and for similar helpers that do actually insert content right there Fred> > Colin-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Friday, January 7, 2011 6:39:17 AM UTC-5, Colin Law wrote:> > I have always assumed that when using form_for in erb one should use > <%= form_for ..... %> > However having done some tests it appears that it works identically > without the ''='' so > <% form_for ... %> is ok. > > Can anyone explain this? I thought that without the ''='' the code > would be run but the result would not be injected into the html. I > appear to be wrong however. >This is mentioned specifically in the Rails 3 release notes: http://edgeguides.rubyonrails.org/3_0_release_notes.html#action-view> Colin >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 7 January 2011 12:57, Tim Shaffer <timshaffer-BUHhN+a2lJ4@public.gmane.org> wrote:> On Friday, January 7, 2011 6:39:17 AM UTC-5, Colin Law wrote: >> >> I have always assumed that when using form_for in erb one should use >> <%= form_for ..... %> >> However having done some tests it appears that it works identically >> without the ''='' so >> <% form_for ... %> is ok. >> >> Can anyone explain this? I thought that without the ''='' the code >> would be run but the result would not be injected into the html. I >> appear to be wrong however. > > This is mentioned specifically in the Rails 3 release notes: > > http://edgeguides.rubyonrails.org/3_0_release_notes.html#action-viewThat link says that one should now use <%= form_for. My confusion (now, at least) is that on rails 3.0.3 I find that it makes absolutely no difference whether one includes the = or not, which appears to be contrary to the information in the link. Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.