私は、ユーザーが投稿できるレールアプリを開発しています。facebook が好きです。ユーザーに新しい投稿を警告する通知システムを実装したいと考えています。ただし、ユーザーが投稿を閲覧したかどうかを判断する方法に問題があります。私は文字通り無知です。
特定のユーザー統計にアクセスできるdevise gemを使用しています(これが役立つ場合):
create_table "users", :force => true do |t|
t.string "email", :default => "", :null => false
t.string "encrypted_password", :default => "", :null => false
t.string "reset_password_token"
t.datetime "reset_password_sent_at"
t.datetime "remember_created_at"
t.integer "sign_in_count", :default => 0
t.datetime "current_sign_in_at"
t.datetime "last_sign_in_at"
t.string "current_sign_in_ip"
t.string "last_sign_in_ip"
t.string "confirmation_token"
t.datetime "confirmed_at"
t.datetime "confirmation_sent_at"
t.string "unconfirmed_email"
t.integer "failed_attempts", :default => 0
t.string "unlock_token"
t.datetime "locked_at"
t.string "authentication_token"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "username", :default => "", :null => false
t.integer "admin", :default => 0
end
そして私の投稿モデル:
create_table "posts", :force => true do |t|
t.integer "user_id"
t.text "content"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
ユーザーが投稿を見たかどうかを知るシステムを実装するにはどうすればよいですか?