<%= f.label_for :name %> is cool as it hides the internal generation of the id attribute for use in the for="">
In most people's views, this is done twice by two different methods, once for the label (manually), then again for the input (using internal rails stuff).

I agree this isn't DRY and there is no way around it without installing plugins.

Having it in the core would promote better practices and should be used by every LabelingFormBuilder and view. There's a reason we have input tag helpers (to encapsulate internal logic and naming schemes) and there should be all the other helpers necessary to complete this encapsulation.

Scaffold generation could be simplified using this (no more duplicated logic) and I can't see a reason why you wouldn't use it.

We shouldn't be leaving the generation of the for attribute up to the developer since it requires an understanding of the internal rails input tag id generation that shouldn't be necessary.

I'm sure I'm not the only one who's created an input tag with a helper, then rendered the view and looked at the source to find out what the for= "" should be.. This should be an unnecessary step.

-Martin


On 7/4/06, Peter Michaux <[EMAIL PROTECTED]> wrote:
On 7/4/06, Rick Olson <[EMAIL PROTECTED]> wrote:

> I personally rarely use a plain label helper.  It's usually less to
> type out than the actual label field.

But it is not as DRY to type it out directly which, I think, is the
whole point of the form builder.

<%= f.label_for :name %>

is a lot less than

<label for=""

and the potential for error wrapping is nice with a helper.

I'll check out your plugin. Thanks for the link.

Peter
_______________________________________________
Rails-core mailing list
Rails-core@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-core

_______________________________________________
Rails-core mailing list
Rails-core@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-core

Reply via email to