granite
granite copied to clipboard
Add a check to ensure created_at and updated_at are Time
If a column is named created_at or updated_at is not a type Time?, then the following occurs:
Code in lib/granite/src/granite/transactions.cr:82:5
82 | {% if @type.instance_vars.select { |ivar| ivar.annotation(Granite::Column) }.map(&.name.stringify).includes? "created_at" %}
^
Called macro defined in lib/granite/src/granite/transactions.cr:82:5
82 | {% if @type.instance_vars.select { |ivar| ivar.annotation(Granite::Column) }.map(&.name.stringify).includes? "created_at" %}
Which expanded to:
> 1 |
> 2 | if mode == :create
> 3 | @created_at = time.at_beginning_of_second
^---------------------
this simply adds a type check.