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

Avatar

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:

ruby
= 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:

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

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.

Avatar

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