Skip to content

Instantly share code, notes, and snippets.

@dcyoung-dev
Created February 4, 2025 15:50
Show Gist options
  • Save dcyoung-dev/9f3314775951b71a96147a8977992237 to your computer and use it in GitHub Desktop.
Save dcyoung-dev/9f3314775951b71a96147a8977992237 to your computer and use it in GitHub Desktop.

What's new in Rails 8

New features and how we can use them in existing applications


Solid everything

πŸ‘·β€β™‚οΈ Solid queue

🏬 Solid cache

🚠 Solid cable


πŸ‘·β€β™‚οΈ Solid queue

  • Direct replacement for Sidekiq
  • Moves queues from Redis to Postgres

🏬 Solid cache

  • Moves caching from Reids to Postgres

🚠 Solid cable

We're probably not using this

  • Moves ActionCable connections from Redis to Postgres

Should we Solid?


πŸ€” Considerations

  • Runs in a separate database on the same server
  • Check Postgres instance size
  • After upgrading all of these we can remove Redis
    • ~$200p/m cache
    • ~$500p/m queue

πŸ‘·β€β™‚οΈ Solid queue βœ…

  • Incrementally update individual jobs to use Solid
    • self.queue_adapter = :solid_queue
  • Check Postgres metrics
    • Possibly upgrade database server

🏬 Solid cache βœ…

  • After upgrading Postgres instance
  • Not sure how to incrementally change
  • Review cache key generation πŸ€•

🚠 Solid cable πŸ€·β€β™‚οΈ

  • Assume we're not using this in our applications

πŸ” Authentication generator

Authentication out of the box


Models

  • User
    • has_secure_password
    • normalizes :email_address, with: -> { it.strip.downcase }
  • Session
    • Database backed sessions make it easy to log everyone out
  • Current
    • Uses ActiveSupport::CurrentAttributes

Functionality

  • Sign in and sign out
  • Password reset
    • Token available through has_secure_password

Should we use our own Authentication?


It depends


Considerations


πŸ†• What else is new?


πŸš€ Thruster

Thrusteris an asset compression and caching proxy ... to help your app run efficiently and safely on the open Internet.


Should we πŸš€ Thruster?

βœ… Possible performance gains ❔Check with infrastructure


🎭 Propshaft

Propshaft is an asset pipeline library for Rails ... a dramatically simpler and faster asset pipeline compared to previous options, likeSprockets.


Should we 🎭 Propshaft?

βœ… Simpler and faster than Sprockets βœ… Remove Webpack while you're there


β›΅ Kamal

Kamal 2for deploying your application anywhere ... you’ll be ready to go into production in under two minutes.


Should we β›΅ Kamal?

❌ We have our own deploy pipeline βœ… Take a look at the new Dockerfile and see how we could slim down our builds βœ… Review test suite runs in CI


πŸ” params.expect

params.expect replacesparams.require


Should we πŸ” params.expect?

βœ… Prevents unwanted parameters - see GoRails video for more details βœ… Rubocop rule has been added


☎️ PWA support


Should we ☎️ PWA?

πŸ€” Probably a design question - I think we should. βœ… Push notifications are coming - ActionNotifier


πŸͺ„ New Rails 8 application

from MVP to_IPO_


πŸ—žοΈ Resources

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment