hello everybody. i think it''d be very convenient to have the builder#object as an optional second parameter in the block for fields_for, e.g.: fields_for(:comments) do |builder, object| # builder.object === object end my proposal in code: https://github.com/glaszig/rails/commit/f22095f0ac120852fff7efc61b6bdf7401b39ad5 before i request a pull - what do you think? -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-core/-/DpEfiDSbYcUJ. 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.
Rafael Mendonça França
2012-Oct-26 12:38 UTC
Re: FormHelper#fields_for: second argument to the block
I don''t know if it is worth. You can use builder.object right now. This can confuse the users with one more way to access the object. I prefer to keep the API simple. Rafael Mendonça França http://twitter.com/rafaelfranca https://github.com/rafaelfranca On Thu, Oct 25, 2012 at 9:33 PM, glaszig <glaszig@gmail.com> wrote:> hello everybody. > > i think it''d be very convenient to have the builder#object as an optional > second parameter in the block for fields_for, e.g.: > > fields_for(:comments) do |builder, object| > # builder.object === object > end > > my proposal in code: > > https://github.com/glaszig/rails/commit/f22095f0ac120852fff7efc61b6bdf7401b39ad5 > > before i request a pull - what do you think? > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Core" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/rubyonrails-core/-/DpEfiDSbYcUJ. > 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.
Matt Huggins
2012-Oct-26 14:03 UTC
Re: FormHelper#fields_for: second argument to the block
I agree with Rafael, this seems unnecessary. On Friday, October 26, 2012 8:39:16 AM UTC-4, Rafael Mendonça França wrote:> > I don''t know if it is worth. You can use builder.object right now. This > can confuse the users with one more way to access the object. I prefer to > keep the API simple. > > Rafael Mendonça França > http://twitter.com/rafaelfranca > https://github.com/rafaelfranca > > > > On Thu, Oct 25, 2012 at 9:33 PM, glaszig <gla...@gmail.com <javascript:>>wrote: > >> hello everybody. >> >> i think it''d be very convenient to have the builder#object as an optional >> second parameter in the block for fields_for, e.g.: >> >> fields_for(:comments) do |builder, object| >> # builder.object === object >> end >> >> my proposal in code: >> >> https://github.com/glaszig/rails/commit/f22095f0ac120852fff7efc61b6bdf7401b39ad5 >> >> before i request a pull - what do you think? >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Ruby on Rails: Core" group. >> To view this discussion on the web visit >> https://groups.google.com/d/msg/rubyonrails-core/-/DpEfiDSbYcUJ. >> To post to this group, send email to rubyonra...@googlegroups.com<javascript:> >> . >> To unsubscribe from this group, send email to >> rubyonrails-co...@googlegroups.com <javascript:>. >> 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 view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-core/-/kabtE1wLiAoJ. 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 agree with Rafael. I don''t see an obvious benefit over `builder.object`. I think block arguments should not be used for optional data and in most cases you don''t need the `object`. Am Freitag, 26. Oktober 2012 01:33:14 UTC+2 schrieb glaszig:> > hello everybody. > > i think it''d be very convenient to have the builder#object as an optional > second parameter in the block for fields_for, e.g.: > > fields_for(:comments) do |builder, object| > # builder.object === object > end > > my proposal in code: > > https://github.com/glaszig/rails/commit/f22095f0ac120852fff7efc61b6bdf7401b39ad5 > > before i request a pull - what do you think? >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-core/-/4OknwHMjJ5wJ. 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.