> On Dec 14, 2019, at 4:42 AM, fugee ohu <fugee...@gmail.com> wrote:
> 
> 
> 
> On Friday, December 13, 2019 at 9:41:29 PM UTC-5, Walter Lee Davis wrote:
> You're looking at the id. If you look at how the form renders in a browser, 
> the name property will be the usual Rails nested format: 
> 
> <input type="date" name="auction_listing[start_date]" 
> id="auction_listing_start_date"> 
> 
> I can't be bothered to write out an entire set of select tags, just imagine 
> if datetime_select was written as date_tag. That's how it would render. 
> 
> Walter 
> 
> > On Dec 13, 2019, at 3:26 PM, fugee ohu <fuge...@gmail.com> wrote: 
> > 
> > I mean the field names Instead of just fieldname it's tablename_fieldname 
> > 
> > -- 
> > You received this message because you are subscribed to the Google Groups 
> > "Ruby on Rails: Talk" group. 
> > To unsubscribe from this group and stop receiving emails from it, send an 
> > email to rubyonra...@googlegroups.com. 
> > To view this discussion on the web visit 
> > https://groups.google.com/d/msgid/rubyonrails-talk/f6241dbd-793c-4efc-b698-eb59d5ed22aa%40googlegroups.com.
> >  
> 
> Heh, yea you're right What versions of rails add the id for scaffold 
> generator? 

I believe this happened in 5.2, and it was a fix to a regression introduced in 
5.1, when they switched the form generator from form_for (which already had 
automatic IDs generated by the tag helpers) to form_with, which removed those. 

Rather than restoring the magical automatic ID attributes, the scaffold 
generator was updated to include the id: 'whatever_attribute' directive in the 
individual tags, and the tag helpers were left alone. 

Previously, if you wanted to suppress the ID for a form element (say, if you 
needed to have two or more identical elements on the page -- think: a bunch of 
checkboxes for the same attribute), you would have to pass id: nil or id: false 
(one of those) to the helper. Now, that's the default behavior, and if you want 
an ID at all, you have to tell it what you want that ID to be. I'm not sure 
where the edge case is here; whether it's more common to want no ID, or to have 
a nice unique one generated for you for free. It's clear what the framework 
designers chose.

Walter

> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to rubyonrails-talk+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/rubyonrails-talk/4ef93297-7203-45bb-a50e-4787856e05c1%40googlegroups.com.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/84B2A9F2-CCA3-4B4F-8B96-2146D2E6F503%40wdstudio.com.

Reply via email to