Forum: Ruby on Rails Learning Rails 1st Edition - Form Builders - Confuzzled

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
40ba541bc54ef6e3c9e6d9e101e19e26?d=identicon&s=25 Rilindo Foster (Guest)
on 2009-06-07 09:05
(Received via mailing list)
Hi! Rails newbie here - so far, loving it.

Going through the Learnings Rails book and the for the most part, I am
learning quite a bit (in spite of the errata). I did see something odd.

On 8.2.2, when I invoke the following private method:

def text_field(method, options={})
  label_for(method, options) + super(method, options)
  def label_for(method, options={})
  label(:label || method) + "<br />"

I should be able to print the label and the field:
<%= f.text_field :name %>

However, it came across on the view screen form, it came across. as:


To actually display the label, I used this instead:

label(options.delete(:label) || method) + "<br />"
Which is fine, but I am little confused - is ' label(:label || method)
+ "<br />" ' supposed to work as intended or was the behavior changed
in the 2.3.x series (which I am using right now)?

  - Rilindo
This topic is locked and can not be replied to.