I have a model that looks like this in my schema.rb
create_table "runs", force: true do |t|
...
t.string "label", default: "Default Run Title", null: false
...
t.datetime "timestamp"
end
However, when I create a new run leaving the label field blank in the form, It stores the run like:
=> #<Run... label: "", .....>
I want to force the default value set to default: "Default Run Title
if the string is passed as an empty string.
What am I missing?
I suppose I can use a validator method or a before_save or something, but I'd rather have the model govern this behavior since this is well within the realm of what default =>
is supposed to do I thought...