I have code like this:
ActiveAdmin.register Post do
form do |f|
f.inputs "Post Details" do
f.input :title
f.input :body
f.input :published_at, :as => DateTime.now
end
f.actions
end
I want the field :published_at
(which is t.datetime) to be set to the current date and time by default. My example doesn't work. How can I achieve this?
Yep. Found the answer myself.
ActiveAdmin.register Post do
form do |f|
f.object.published_at = DateTime.now
f.inputs "Post Details" do
f.input :title
f.input :body
f.input :published_at
...
end
end