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

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community 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)
end
private
  def label_for(method, options={})
  label(:label || method) + "<br />"
end

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:

Label
[FIELD BOX]

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.