Add "updated at" to blog posts
This commit is contained in:
parent
01bcdf3a2d
commit
1451104b75
|
@ -14,4 +14,10 @@ module ApplicationHelper
|
|||
render "shared/flash"
|
||||
end
|
||||
end
|
||||
|
||||
def updated_at(object)
|
||||
return "" if object.created_at == object.updated_at
|
||||
|
||||
object.updated_at.strftime("%Y-%m-%d %H:%M")
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
<p><%= @blog_post.content %></p>
|
||||
<div class="created_at">
|
||||
<%= link_to "Edit", edit_blog_post_path(@blog_post) if @blog_post.user == current_user %>
|
||||
<%= "Updated at #{updated_at(@blog_post)} | " %>
|
||||
<%= link_to @blog_post.created_at.strftime("%Y-%m-%d %H:%M"), @blog_post %>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -45,7 +45,6 @@ Rails.application.configure do
|
|||
# config.action_cable.url = "wss://example.com/cable"
|
||||
# config.action_cable.allowed_request_origins = [ "http://example.com", /http:\/\/example.*/ ]
|
||||
|
||||
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
||||
config.force_ssl = false
|
||||
config.assume_ssl = true
|
||||
|
||||
|
|
Loading…
Reference in New Issue