2:48 Create Notification model 6:55 Add associations in Notification model with polymorphic true 7:35 Add associations to User model with foreign key 9:15 Add association in the Forum Thread model with through: forum_posts 9:40 Create a new notification in Forum Posts controller for each recipient 11:47 Add uniq to array and subtract current_user 15:25 Create Notifications controller 16:15 Make scope in model 16:50 Make index.json .jbuilder in the view 18:07 Set json.url to make a link 19:10 Viewing notifications.json 20:56 Set json.notifiable 22:26 Add methods 25:16 Add routes 25:33 Add mark_as_read method in Notifications Controller 27:48 Create notifications.js.coffee and create an HTML 29:18 add data-behavior in HTML 30:00 add Ajax 31:23 Add anchor tags in success 33:38 Add unread count 34:50 Hide after viewing by adding mark_as_read
So if I want to add notifications to an accepted/denied request. Do I add the notification line to the request page? Is that all or do I have to modify any other file?
I'd love to see this with react. One thing to add on to this video is that in index.json.jbuilder, you want to change forum_thread_path to polymorphic_path, just because otherwise it really isn't generic.
2:48 Create Notification model
6:55 Add associations in Notification model with polymorphic true
7:35 Add associations to User model with foreign key
9:15 Add association in the Forum Thread model with through: forum_posts
9:40 Create a new notification in Forum Posts controller for each recipient
11:47 Add uniq to array and subtract current_user
15:25 Create Notifications controller
16:15 Make scope in model
16:50 Make index.json .jbuilder in the view
18:07 Set json.url to make a link
19:10 Viewing notifications.json
20:56 Set json.notifiable
22:26 Add methods
25:16 Add routes
25:33 Add mark_as_read method in Notifications Controller
27:48 Create notifications.js.coffee and create an HTML
29:18 add data-behavior in HTML
30:00 add Ajax
31:23 Add anchor tags in success
33:38 Add unread count
34:50 Hide after viewing by adding mark_as_read
Can I create the navbar notification using hotwire in rails 7 application?
Great! Thanks Chris, any news about React component for showing notifications?
I would love to see more along the React path Chris. That'd be very interesting.
if i said.. a notification that says "We are processing your request, please wait", then what is the trackable id?
So if I want to add notifications to an accepted/denied request. Do I add the notification line to the request page? Is that all or do I have to modify any other file?
Would love to see how this would not work if one notification needs to target 1,000+ users.
I'd love to see this with react.
One thing to add on to this video is that in index.json.jbuilder, you want to change forum_thread_path to polymorphic_path, just because otherwise it really isn't generic.
Yeah! Let's do it in React. That would be nice to have both ways.