1

Been reading this part of the Rails API: http://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html and just asking, why do some fields result in an error? For example, color_field and week_field.

I'm just tinkering around with the Hartl tutorial, specifically this part in 8.1

<%= form_for(:session, url: sessions_path) do |f| %>
    <%= f.label :email %>
    <%= f.text_field :email %>

    <%= f.label :password %>
    <%= f.password_field :password, :value => 'password' %>

    <%= f.label :color %>

    <%= f.number_field :color %>

    <%= f.submit 'Sign in', class: 'btn btn-large btn-primary' %>


<% end %>

but basically when I put color_field or week_field it results in

undefined method `color_field' for #<ActionView::Helpers::FormBuilder:0x402bac0>

Why is this happening?

4

1 回答 1

0

请检查以下链接,它可能会提供一些帮助。

http://edgeguides.rubyonrails.org/form_helpers.html#other-helpers-of-interest

于 2013-06-26T07:06:28.830 回答