How to use date_field rails helper?

I am completely new to rubies on rails and try to follow the guidance of the rails in shape assistants . When I try to use the date_field helper with:

<%= date_field(:user, :born_on) %> 

I get an error message:

 undefined method `date_field' for #<#<Class:0x007fa42ffe3dc0>:0x007fa42f82c410> 

Do I have to include something to use certain helpers? Thanks!

+6
source share
1 answer

date_field() is a new helper in Ruby on Rails 4.0, so you are probably using an older version, like 3.2.13.

These are examples of form helpers available in Rails 3.2.13:

 <%= text_area_tag(:message, "Hi, nice site", :size => "24x6") %> <%= password_field_tag(:password) %> <%= hidden_field_tag(:parent_id, "5") %> <%= search_field(:user, :name) %> <%= telephone_field(:user, :phone) %> <%= url_field(:user, :homepage) %> <%= email_field(:user, :address) %> 

And you can find documentation on this subject here: http://guides.rubyonrails.org/v3.2.13/form_helpers.html#other-helpers-of-interest

+6
source

Source: https://habr.com/ru/post/949033/


All Articles