diff --git a/app/models/communication/website/post.rb b/app/models/communication/website/post.rb index e81056ab8e7f3ef8cb8ed10b115401719048f1db..38a64202cf3e718e0729707aa5ebf6ac4d27110e 100644 --- a/app/models/communication/website/post.rb +++ b/app/models/communication/website/post.rb @@ -65,7 +65,7 @@ class Communication::Website::Post < ApplicationRecord validates :title, presence: true - before_validation :set_published_at, if: :published_changed? + before_validation :set_published_at after_save_commit :update_authors_statuses!, if: :saved_change_to_author_id? scope :published, -> { diff --git a/app/views/admin/communication/websites/posts/_form.html.erb b/app/views/admin/communication/websites/posts/_form.html.erb index c53bd9a5876ffb03287a3cad0f0b0b53ff55f285..fbdcea1d787919b561a77bca600387c51d2ac6a2 100644 --- a/app/views/admin/communication/websites/posts/_form.html.erb +++ b/app/views/admin/communication/websites/posts/_form.html.erb @@ -36,7 +36,7 @@ <%= f.input :pinned %> </div> </div> - <%= f.input :published_at, html5: true %> + <%= f.input :published_at, html5: true, as: :date %> <% end %> <% if @website.languages.many? %> <%= f.input :language_id, collection: @website.languages, include_blank: false %>