How to use grep to filter down a long list of Rails routes. In this video I’ll explain how to use grep to filter down a long list of Rails routes. This is useful for larger apps where the list of Rails routes can be very long 🔗 Full Rails API tutorial:...
How to use grep to filter down a long list of Rails routes.
In this video I’ll explain how to use grep to filter down a long list of Rails routes. This is useful for larger apps where the list of Rails routes can be very long
🔗 Full Rails API tutorial: https://www.youtube.com/watch?v=FJiIvFoxqsc&list=PLbTv9eGiI03t_gMnEoGakDyDt6r79s5Dm
#rubyonrails #railsroutes #routes #grep #shorts
Learn how to build a Rails API application and how to build endpoints for listing and creating records from the database. This is the first video in my Rails 7 API tutorial series. 📖 You can purchase the eBook and code for this tutorial -...
Learn how to build a Rails API application and how to build endpoints for listing and creating records from the database. This is the first video in my Rails 7 API tutorial series.
📖 You can purchase the eBook and code for this tutorial - https://tomkadwill.gumroad.com/l/rails-api-tutorial
00:00 - Intro
00:21 - Building a payments API
00:52 - Building a new Rails API-only app
01:26 - Adding a route for our first endpoint
02:27 - Adding a controller for our first endpoint
04:04 - Testing GET /payments endpoint
04:45 - Generating a model for payments
06:15 - Running a database migration
07:12 - Update controller to return payments from the DB
07:50 - Adding DB records via rails console
09:11 - Adding POST /payments route
09:49 - Using rails routes and discovering a bug
10:57 - Adding controller action for creating a payment
11:59 - Improving the create action to handle errors
14:19 - Improving the create actions using strong params
16:01 - Testing POST /payments
Download Postman for easier API requests - https://www.postman.com/
How to build an API endpoint using Ruby on Rails. In this video I’ll create a GET endpoint for listing multiple resources. I’m Rails 7. Finally I’ll test the endpoint using cURL. 🔗 Full Rails API tutorial:...
How to build an API endpoint using Ruby on Rails.
In this video I’ll create a GET endpoint for listing multiple resources. I’m Rails 7. Finally I’ll test the endpoint using cURL.
🔗 Full Rails API tutorial: https://www.youtube.com/watch?v=FJiIvFoxqsc&list=PLbTv9eGiI03t_gMnEoGakDyDt6r79s5Dm
#rubyonrails #api #shorts
There is a lot of hype around OpenAI and ChatGPT's use for development. Can I use ChatGPT to build me a Rails API? I'll ask ChatGPT to build me an API with increasing complex requirements and see how far it gets. 00:37 - Building a rails --api app with a GET index endpoint...
There is a lot of hype around OpenAI and ChatGPT's use for development. Can I use ChatGPT to build me a Rails API? I'll ask ChatGPT to build me an API with increasing complex requirements and see how far it gets.
00:37 - Building a rails --api app with a GET index endpoint
04:23 - Adding a DELETE endpoint
06:25 - Versioning the API
08:42 - Adding JWT authentication
13:46 - Thoughts on ChatGPT
This video covers: 0:15 - Context blocks 4:07 - RSpec let 6:16 - described_class 7:17 - subject 7:59 - Simplifying tests with subject and 1-line expectations In this video I'll cover how to use context blocks, within RSpec describe blocks, to test different cases. I'll cover...
This video covers:
0:15 - Context blocks
4:07 - RSpec let
6:16 - described_class
7:17 - subject
7:59 - Simplifying tests with subject and 1-line expectations
In this video I'll cover how to use context blocks, within RSpec describe blocks, to test different cases. I'll cover RSpec's let feature and explain how to use it to simplify your tests. Lastly I'll cover RSpec's `described_class` and `subject` methods and explain how to use them with a real world example.
This video covers: 00:29 - Installing RSpec 01:37 - Setting ruby version for rbenv 02:17 - Creating spec directory and first test file 02:57 - Writing our first basic test 04:13 - Running tests via bundler in the cli 04:57 - describe block 06:18 - it block 07:26 - Writing a...
This video covers:
00:29 - Installing RSpec
01:37 - Setting ruby version for rbenv
02:17 - Creating spec directory and first test file
02:57 - Writing our first basic test
04:13 - Running tests via bundler in the cli
04:57 - describe block
06:18 - it block
07:26 - Writing a real world test for a User class
10:00 - Verifying the test is correct
In this tutorial series I'll cover the most important parts of testing using RSpec 3 and Rails 7. First, I'll explain how to install RSpec and create your first test. After writing the test, I'll show you how to run it via the CLI. I'll cover the basics of structuring RSpec tests using 'describe' and 'it' blocks. Lastly, I'll tie everything together with a real works example.
Checkout this new tutorial series about testing Rails with RSpec. The course uses RSpec 3 and Rails 7 and covers: - Installing RSpec - RSpec 3 syntax - Testing models - Testing controllers - Testing views - Testing mailers, background jobs & ActionCable (all in Rails 7) -...
Checkout this new tutorial series about testing Rails with RSpec. The course uses RSpec 3 and Rails 7 and covers:
- Installing RSpec
- RSpec 3 syntax
- Testing models
- Testing controllers
- Testing views
- Testing mailers, background jobs & ActionCable (all in Rails 7)
- Testing JSON APIs
- Writing integration tests
- And much much more..
In this video series we will build a Rails API from scratch. Backend APIs are useful for serving data to frontend applications, mobile apps or other backend services. ✨ Check out the new version of this video series, which has been updated for Rails 7...
In this video series we will build a Rails API from scratch. Backend APIs are useful for serving data to frontend applications, mobile apps or other backend services.
✨ Check out the new version of this video series, which has been updated for Rails 7 https://youtu.be/FJiIvFoxqsc
📖 You can also purchase the eBook and code for the new Rails 7 tutorial - https://tomkadwill.gumroad.com/l/rails-api-tutorial
This video covers:
00:18 - Running specs to check for failing tests
00:36 - Fixing controller specs by stubbing AuthenticationTokenService
05:31 - Fixing request specs by including a JWT Authorization header with a valid user id
10:52 - Fixing controller to return a 401 when Authorization header is missing, instead of raising an exception
18:31 - Updating AuthenticationTokenService method names
If you’re new to this series, you may want to start with part 1: https://youtu.be/6KqbPJtA5O8
In this video series we will cover RSpec and how to use it to test Rails applications. This video covers: 00:00 - Introduction 00:36 - Creating a new Rails app 01:00 - Installing Rspec 02:14 - Test Driven Development (TDD) 04:38 - Removing the test directory 05:07 - Creating...
In this video series we will cover RSpec and how to use it to test Rails applications.
This video covers:
00:00 - Introduction
00:36 - Creating a new Rails app
01:00 - Installing Rspec
02:14 - Test Driven Development (TDD)
04:38 - Removing the test directory
05:07 - Creating post_spec.rb boilerplate
06:14 - Running our first failing test
06:39 - Creating a Post class to get the tests green
07:29 - Add test for checking Post is valid
08:31 - Replacing Post with an ActiveRecord class
11:28 - Add title field to Post
14:52 - Adding a model validation
17:45 - Using described_class
In this video series we will cover RSpec and how to use it to test Rails applications. This video covers: 00:00 - Video series introduction 00:32 - Why write tests? 02:09 - Why RSpec? 03:05 - Getting familiar with RSpec syntax 03:35 - Creating a new project and installing...
In this video series we will cover RSpec and how to use it to test Rails applications.
This video covers:
00:00 - Video series introduction
00:32 - Why write tests?
02:09 - Why RSpec?
03:05 - Getting familiar with RSpec syntax
03:35 - Creating a new project and installing RSpec
04:59 - Writing a ruby class to use for testing
06:26 - Adding a spec file for user.rb
07:24 - Adding a describe block for User specs
07:40 - Adding a test case using an it block
08:28 - Adding an expectation
09:29 - Failing expectation
09:57 - Writing a test that exercises the User class
11:57 - What could be improved
12:19 - What to expect from this video series
In this video series we will build a Rails API from scratch. Backend APIs are useful for serving data to frontend applications, mobile apps or other backend services. ✨ Check out the new version of this video series, which has been updated for Rails 7...
In this video series we will build a Rails API from scratch. Backend APIs are useful for serving data to frontend applications, mobile apps or other backend services.
✨ Check out the new version of this video series, which has been updated for Rails 7 https://youtu.be/FJiIvFoxqsc
📖 You can also purchase the eBook and code for the new Rails 7 tutorial - https://tomkadwill.gumroad.com/l/rails-api-tutorial
This video covers:
00:00 - Introduction
00:30 - Recap how the /authenticate endpoint works
01:36 - Making API endpoints require authentication
01:52 - Adding a before_action to check authentication
03:32 - Authentication Bearer "token" scheme
04:36 - Parsing the Authentication header and fetching the token using token_and_options
06:55 - Updating the specs to include an authentication header
08:29 - Adding logic to decode the JWT (that's been fetched from the header) and extract the user_id
12:41 - Updating the specs to pass a real JWT in the header
14:28 - Using the user_id to do a database lookup with User.find and resuing exceptions
16:26 - Testing it out with cURL
If you’re new to this series, you may want to start with part 1: https://youtu.be/6KqbPJtA5O8
In this video series we will build a Rails API from scratch. Backend APIs are useful for serving data to frontend applications, mobile apps or other backend services. ✨ Check out the new version of this video series, which has been updated for Rails 7...
In this video series we will build a Rails API from scratch. Backend APIs are useful for serving data to frontend applications, mobile apps or other backend services.
✨ Check out the new version of this video series, which has been updated for Rails 7 https://youtu.be/FJiIvFoxqsc
📖 You can also purchase the eBook and code for the new Rails 7 tutorial - https://tomkadwill.gumroad.com/l/rails-api-tutorial
This video covers:
00:00 - Introduction
00:38 - Adding a new password field
01:32 - Using has_secure_password
01:52 - Using bcrypt for the hashing algorithm
02:58 - Adding a password_digest field
03:54 - Adding has_secure_password to the User model
04:23 - Testing user passwords in the rails console
05:15 - Updating authentication specs with the new password field
06:50 - Adding a new test case for when password is invalid
08:50 - Adding logic to check the user's password, to the authentication controller
10:22 - Adding an AuthenticationError class
11:25 - Rescuing AuthenticationError with rescue_from and returning a 401 (unauthorized) status code
12:56 - Tidying up the controller
14:24 - Testing with cURL
16:35 - Some thoughts on other Rails authentication frameworks
If you’re new to this series, you may want to start with part 1: https://youtu.be/6KqbPJtA5O8
In this video series we will build a Rails API from scratch. Backend APIs are useful for serving data to frontend applications, mobile apps or other backend services. ✨ Check out the new version of this video series, which has been updated for Rails 7...
In this video series we will build a Rails API from scratch. Backend APIs are useful for serving data to frontend applications, mobile apps or other backend services.
✨ Check out the new version of this video series, which has been updated for Rails 7 https://youtu.be/FJiIvFoxqsc
📖 You can also purchase the eBook and code for the new Rails 7 tutorial - https://tomkadwill.gumroad.com/l/rails-api-tutorial
This video covers:
00:00 - Introduction
00:13 - Generating a User model
00:59 - Finding the user, from params, in the authentication controller
01:37 - Calling AuthenticationTokenService and passing in the User ID
02:22 - Running the migrations
02:56 - Using FactoryBot to create a user in the specs
05:01 - Updating AuthenticationTokenService to receive user_id and add it to the JWT payload
06:25 - Fixing the AuthenticationTokenService spec
07:41 - Deleting unused pending spec
08:05 - Creating a User in the DB, in order to manually test authentication
08:48 - Testing the authenticate API via cURL
10:47 - Updating the controller to return the JWT generated from AuthenticationTokenService
12:01 - Checking the JWT on jwt.io
If you’re new to this series, you may want to start with part 1: https://youtu.be/6KqbPJtA5O8
In this video series we will build a Rails API from scratch. Backend APIs are useful for serving data to frontend applications, mobile apps or other backend services. ✨ Check out the new version of this video series, which has been updated for Rails 7...
In this video series we will build a Rails API from scratch. Backend APIs are useful for serving data to frontend applications, mobile apps or other backend services.
✨ Check out the new version of this video series, which has been updated for Rails 7 https://youtu.be/FJiIvFoxqsc
📖 You can also purchase the eBook and code for the new Rails 7 tutorial - https://tomkadwill.gumroad.com/l/rails-api-tutorial
This video covers:
00:00 - Introduction
00:21 - Service classes
00:45 - Creating a services directory
01:24 - Writing initial test case for an authentication token service
03:54 - defining a class method on the authentication token service
05:12 - Generating a JWT using the ruby-jwt gem
08:42 - Adding JWT decode logic to the spec, to verify the token
10:54 - Removing duplicate code and tidying up
13:41 - Recap of what's left to build for our API authentication
If you’re new to this series, you may want to start with part 1: https://youtu.be/6KqbPJtA5O8
In this video series we will build a Rails API from scratch. Backend APIs are useful for serving data to frontend applications, mobile apps or other backend services. ✨ Check out the new version of this video series, which has been updated for Rails 7...
In this video series we will build a Rails API from scratch. Backend APIs are useful for serving data to frontend applications, mobile apps or other backend services.
✨ Check out the new version of this video series, which has been updated for Rails 7 https://youtu.be/FJiIvFoxqsc
📖 You can also purchase the eBook and code for the new Rails 7 tutorial - https://tomkadwill.gumroad.com/l/rails-api-tutorial
This video covers:
00:00 - Introduction
00:27 - Adding a request spec for authentication
02:29 - Adding an /authenticate route
03:34 - Adding an AuthenticationController with 'create' action
04:45 - Updating the spec to post username and password params
05:49 - Updating the spec to check the response code is :created
06:24 - Adding an expectation to check the response body contains a token
07:15 - Adding 'render :json' to the controller, with token and status
08:00 - Adding a test for the case where user doesn't provide username/password
10:36 - Using required params in the auth controller
12:06 - Adding a rescue_from block to catch ParameterMissing and return error response
14:08 - Adding expectation to check the response body includes missing param message
If you’re new to this series, you may want to start with part 1: https://youtu.be/6KqbPJtA5O8