How to create a blog in Ruby on Rails API part 2 - creating, updating, and deleting
Now that you have a model and can display out the blog posts, we want to be able to create, update, and delete more posts. But what about making sure the post is only editable by the proper user? And what format do we want to send them to our frontends in via our API? In this episode, we'll create API endpoints for create, update, and delete, and then explore the Pundit Gem and the jsonapi-serializer Gem based on https://jsonapi.org/.
š¤Æ Support on Patreon
ā±ļø Timestamps:
š Newsletter:
šŖElsewhere:
šConcepts:
šResources:
š¬ Subscribe!
My name is David W Parker and Iām creating and publishing videos on ProgrammingTIL to help teach anyone and everyone who wants to code. Iām a huge fan of Ruby on Rails, Svelte, TailwindCSS, and WebGL. Iāve used React a lot in the past, as well as some Vue and AngularJS. Iāve done some professional Python and Django. I like to create real applications and my tutorials will walk you through how to build something real from beginning-to-end.
š¤Æ Support on Patreon
- https://www.patreon.com/davidwparker
ā±ļø Timestamps:
- 00:00 - Introduction
- 00:50 - Test coverage results
- 01:20 - Gemfile
- 02:05 - JSON API Serializer and jsonapi.org spec
- 03:45 - Pundit Gem
- 04:15 - posts controller and logic changes for create, update and delete
- 10:45 - adding Pundit / how pundit works
- 18:45 - adding specs to test access
š Newsletter:
- https://www.programmingtil.com/
šŖElsewhere:
- Twitter: https://twitter.com/davidwparker
- Twitter: https://twitter.com/programmingtil
- GitHub: https://github.com/davidwparker
šConcepts:
- Create, update and delete API endpoints for our Blog Post model
šResources:
- https://github.com/davidwparker/programmingtil-rails/tree/ep16
- https://jsonapi.org/
- https://github.com/jsonapi-serializer/jsonapi-serializer
- https://github.com/varvet/pundit
š¬ Subscribe!
- http://bit.ly/subdavidwparker
My name is David W Parker and Iām creating and publishing videos on ProgrammingTIL to help teach anyone and everyone who wants to code. Iām a huge fan of Ruby on Rails, Svelte, TailwindCSS, and WebGL. Iāve used React a lot in the past, as well as some Vue and AngularJS. Iāve done some professional Python and Django. I like to create real applications and my tutorials will walk you through how to build something real from beginning-to-end.
ruby #rails #rubyonrails
Ā© programmingtil.com