I made a selector for the date one month ago (because the new calendar widget doesn’t work with Safari and other browsers). You can check the Day 43 there I use a select for a month, day and year.

So, to register the date of my Inputs and Outputs, I need a gem to cast the value to a date. In this case I use ohm-contrib

This gem works like this:

You need to install the gem in your terminal.

$ dep add ohm-contrib
$ dep install ohm-contrib

Then you requiere it in your app:

require 'ohm'
require 'ohm/contrib'

Go to your model and include Ohm::DataTypes

class Input < Ohm::Model
  include Ohm::DataTypes

  attribute :date, Type::Date

  reference :user, :User
  reference :type, "::Type"
end
class Output < Ohm::Model
  include Ohm::DataTypes
  reference :user, :User

  attribute :date, Type::Date
  attribute :duration, Type::Integer
  attribute :scale, Type::Integer
end