mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-15 04:51:43 +00:00
si no enviamos fecha hay que poner una por defecto
This commit is contained in:
parent
0dc9d1d157
commit
593b087ba1
1 changed files with 6 additions and 0 deletions
|
@ -413,6 +413,7 @@ class Post
|
|||
|
||||
def cleanup!
|
||||
things_to_arrays!
|
||||
default_date_is_today!
|
||||
date_to_time!
|
||||
clean_content!
|
||||
slugify_title!
|
||||
|
@ -501,12 +502,17 @@ class Post
|
|||
@errors
|
||||
end
|
||||
|
||||
def default_date_is_today!
|
||||
set_front_matter('date', Time.now) unless date
|
||||
end
|
||||
|
||||
def date_to_time!
|
||||
unless @front_matter.dig(:date).is_a? Time
|
||||
@front_matter['date'] = @front_matter.dig('date').try(:to_time) || Time.now
|
||||
end
|
||||
end
|
||||
|
||||
# XXX es necesario ahora que tenemos select2?
|
||||
def things_to_arrays!
|
||||
[:tags,:categories].each do |c|
|
||||
thing = @front_matter.dig(c.to_s)
|
||||
|
|
Loading…
Reference in a new issue