Quantcast
Channel: Creating a feed (following) grouped by day and user that is ordered by most recent on ruby on rails - Stack Overflow
Viewing all articles
Browse latest Browse all 2

Creating a feed (following) grouped by day and user that is ordered by most recent on ruby on rails

$
0
0

I am trying to do a feed (kinda timeline following feed in a daily manner)

I have a table photos where it stores photos uploaded by the user, a table follows which stores the user that each user is following.

 create_table "photos", force: :cascade do |t| ...    t.integer  "user_id"    t.datetime "created_at"    t.datetime "updated_at" ...create_table "follows", force: :cascade do |t|    t.integer  "followable_id",                   null: false    t.string   "followable_type",                 null: false    t.integer  "follower_id",                     null: false    t.string   "follower_type",                   null: false    ...    t.datetime "created_at"    t.datetime "updated_at"end

Basically, I want to accomplish a feed that looks like this (easier drawn than explain)

enter image description here

  • most recent appear at the top
  • group all photos uploaded by the user we are "following" including my own in "a day"
  • display today, yesterday, 2 days ago and so forth

Viewing all articles
Browse latest Browse all 2

Trending Articles