Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

DEFAULT_*_OPTIONS cause inconsistencies in FormHelper

#5332

For example, DEFAULT_FIELD_OPTIONS is {'size' => 30}, which causes text_field to emit a size="30" HTML attribute. The inconsistencies are
in the RDoc; e.g., the 2nd and 3rd examples in texxt_field's RDoc are wrong in relation to FormTagHelper, which doesn't use these defaults; for example, un-styled text fields generated with text_field look different from those generated with text_field_tag

I would also argue that these defaults violate the principle of least surprise. They're also bad design practice, because they put presentation details in mark-up. Width and height should be specified via CSS.

I'll be happy to produce a patch that eliminates these defaults, if core likes the idea, and it would be accepted.

The DEFAULT*OPTIONS are constants and frozen hashes, so plug-ins shouldn't rely on being able to modify them. So I hope that removing them won't break too much 3rd party code.

Reported by Victor Costan · August 8th, 2010 @ 12:33 AM

State: stale
Milestone: none
Assigned to: nobody
Importance: Low

Activity

  1. Victor Costan
    Victor Costan

    Added a patch that removes DEFAULT*OPTIONS in FormHelper. Will follow up with a patch that sets input field sizes in scaffold.css.

    August 8th, 2010 @ 01:55 AM

  2. Victor Costan
    Victor Costan

    The feature removed by the patch above is re-added by this patch, using CSS.

    August 8th, 2010 @ 02:09 AM

  3. Victor Costan
    Victor Costan

    The comment above is spam, please remove. The user also seems to be a serial spammer.

    August 10th, 2010 @ 06:12 AM

  4. Victor Costan
    Victor Costan
    • Tag changed from actionview to actionview, patch

    Can someone please look at this ticket before it gets overrun with spam?

    August 10th, 2010 @ 02:53 PM

  5. Andrea Campi
    Andrea Campi

    I like your idea so I will gladly upvote it, but the patch doesn't apply anymore. Can you reroll it?

    October 10th, 2010 @ 11:21 PM

  6. Victor Costan
    Victor Costan

    @Andrea: I will do so right now. Thanks!

    October 11th, 2010 @ 12:07 AM

  7. Victor Costan
  8. Victor Costan
    Victor Costan

    The CSS patch still applies cleanly for me. Is there anything else I should do?

    October 11th, 2010 @ 01:12 AM

  9. Ryan Bigg
    Ryan Bigg
    • Tag cleared.
    • Importance changed from to Low

    Automatic cleanup of spam.

    October 11th, 2010 @ 02:59 AM

  10. Ryan Bigg
    Ryan Bigg

    Automatic cleanup of spam.

    October 11th, 2010 @ 02:59 AM

  11. Victor Costan
    Victor Costan

    @Ryan: thank you for the clean-up!

    Please let me know if there is anything else I can do in support of this patch!

    October 11th, 2010 @ 03:01 AM

  12. Ryan Bigg
    Ryan Bigg

    Automatic cleanup of spam.

    October 11th, 2010 @ 03:06 AM

  13. Andrea Campi
    Andrea Campi

    +1; I verified this works by creating a new scaffold, and tests pass.

    October 11th, 2010 @ 07:19 AM

  14. Ryan Bigg
    Ryan Bigg

    Automatic cleanup of spam.

    October 19th, 2010 @ 08:25 AM

  15. Santiago Pastorino
    Santiago Pastorino
    • State changed from new to open

    This issue has been automatically marked as stale because it has not been commented on for at least three months.

    The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.

    Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.

    February 2nd, 2011 @ 04:48 PM

  16. Santiago Pastorino
    Santiago Pastorino
    • State changed from open to stale

    February 2nd, 2011 @ 04:48 PM