Using rails (4.2.10)
and rails_admin (1.2.0)
I am trying to addd a default date value to the confirmed_at
field of the User
Model.
It works on the edit view but not on the new view.
Here is my code :
config.model 'User' do
list do
[...]
end
show do
[...]
end
edit do
field :confirmed_at do
default_value DateTime.now
end
exclude_fields
[...]
end
end
Try returning a string instead and format it using the same format rails admin uses for datetime fields. I believe it to be
You can also try initializing the object with a default value on your model like this:
In an unrelated topic you should really be using Time.zone.now to avoid problems with time zones.