Learning Rails 1st Edition - Form Builders - Confuzzled


#1

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) + “

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) + “

Which is fine, but I am little confused - is ’ label(:label || method)


  • ” ’ supposed to work as intended or was the behavior changed
    in the 2.3.x series (which I am using right now)?

    • Rilindo