RailsCasts Pro episodes are now free!

Learn more or hide this

Mark Holmberg's Profile

GitHub User: mark-d-holmberg

Site: http://www.markholmberg.com

Comments by Mark Holmberg


Simple Form needs to submit the name of the zone, not the default to_s value. To do that, try the following in the form:

= f.input :time_zone, collection: ActiveSupport::TimeZone.us_zones.map { |zone| [zone.name, zone.name] }, selected: @company.time_zone.nil? ? Time.zone : @company.time_zone

In the model I only validate against US time zones in the following fashion:

validates :time_zone,
    inclusion: { in: ActiveSupport::TimeZone.us_zones.map(&:name) }

THANK YOU! I wrote my college Software Engineering project using the old version of this video, and this new approach makes it so much simpler! Keep them coming.


If you use bootstrap-sass gem, does it have the same generators and what not as the twitter-bootstrap-rails gem?