NoMethodError for time_zone_select in form

I installed my application exactly according to Railscasts Time Zone Episode 1 , but when I started

<%= f.time_zone_select :time_zone, ActiveSupport::TimeZone.us_zones %>

I get this error

NoMethodError in Users # new

Application mapping /views/users/new.html.erb where line # 27 is raised:

You have a null object, when you did not do this, expect it! Perhaps you were expecting an array instance. An error occurred while evaluating nil. <=>

Line 27 has the above line. I'm really stuck on this ...

+3
source share
4 answers

time_zone? ?

- :

add_column :users, :time_zone, :string

rake db:migrate
0

, 2.3.8, ​​ .

, , , Rails TZInfo. HTML, Pacific Time (US & Canada) Pacific Time (US &amp; Canada). http://github.com/rails/rails/commit/78e4d88c7071c633ee1eb68f49b90719aa198eaa , , .

0
source

I had the same issue due to which one of my Cucumber tests failed. I upgraded to Rails 2.3.9 (from 2.3.8) and all tests passed. Good luck

0
source

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


All Articles