Commit b0ab55fb by tady

commentのcallbackを追加

parent 9f411a7e
......@@ -17,4 +17,13 @@ class Comment < ActiveRecord::Base
validates :author_id, presence: true
validates :post_id, presence: true
validates :body, presence: true
### Callback ###
after_save :notify_author
private
def notify_author
post.author.push_notification(post.decorate.show_path, "#{author.name}さんがあなたの投稿にコメントしました")
end
end
......@@ -23,6 +23,8 @@
h2.panel-title 最近投稿されたタグ
.panel-body.list-group
- Tag.recent(10).each_with_index do |tag, i|
a.list-group-item data-tag-id=tag.id href=search_path(q: "##{tag.name}") = "#{tag.name} (#{tag.posts_count})"
a.list-group-item data-tag-id=tag.id href=search_path(q: "##{tag.name}")
= tag.name
span.badge = tag.posts_count
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment