pwshub.com

Rails 8.0 is out — Rails 8.0.0.beta1 brings simplicity with killer features such as a new authentication system and reduced dependency overhead.

Rails 8.0 has arrived, bringing along many exciting new features that aim to simplify and empower the Rails development workflow.

"The medicine you don’t wanna take but it’s good for you" – DHH

Rails 8.0 introduces a new authentication approach, designed to provide clarity and guide developers effectively.

"Rails 8 is not going to ship with Devise. It’s not going to ship with a black box security" – DHH

Is this the beginning of the end of separate authentication gems?

The authentication setup is implemented through the generate command. When you execute the command bin/rails generate authentication, it will generate the necessary files to start the basic authentication setup.

Below is the list of files generated by the command:

app/models/current.rb
app/models/user.rb
app/models/session.rb
app/controllers/sessions_controller.rb
app/controllers/passwords_controller.rb
app/mailers/passwords_mailer.rb
app/views/sessions/new.html.erb
app/views/passwords/new.html.erb
app/views/passwords/edit.html.erb
app/views/passwords_mailer/reset.html.erb
app/views/passwords_mailer/reset.text.erb
db/migrate/xxxxxxx_create_users.rb
db/migrate/xxxxxxx_create_sessions.rb
test/mailers/previews/passwords_mailer_preview.rb

As you can see it has the whole structure needed for sessions, password reset, and user management. It solves 90% of the cases, but if you need to customize it, you can do so by changing the generated files.

Solid Trifecta

Modern web applications used to require multiple data storage. One is for websocket updates, another is for cache, and another is for the main data.

We don’t need this anymore. We can collapse all of them into a single storage device. SSD drives are fast enough to make the difference between them and RAM is barely used for most operations.

Solid Trifecta is a set of database-backed adapters that can replace traditional Redis, RabbitMQ, and other storage systems.

Solid Cable for Action Cable

Solid Cable is a database-backed adapter for ActionCable that uses the main database to store the websocket updates.

Solid Cache

Solid Cache is the new and default cache adapter for Active Support.

Solid Queue

Now this is a killer feature: Solid Queue. It reduces the overhead of having a queue system by eliminating the need for multiple gems and complex configurations. It’s easy to set up whether you’re deploying a single server or a dedicated queue server.

Solid Queue also allows for recurring jobs.

The Trifecta is fully featured for the three major database systems: MySQL, PostgreSQL, and SQLite.

Thruster

Thruster is a non-config by default, HTTP/2 proxy for simple production-ready deployments of Rails applications. It runs alongside the Puma webserver to provide a few additional features that help your app run efficiently and safely on the open Internet:

  • HTTP/2 support
  • Automatic TLS certificate management with Let’s Encrypt
  • Basic HTTP caching of public assets
  • X-Sendfile support and compression, to efficiently serve static files

Thruster is installed by default (to skip use --skip-thruster) and will be
used to serve your Rails application in production.

In the Dockerfile generated by rails new you will see the following line:

CMD ["./bin/thrust", "./bin/rails", "server"]

What more?

  • Propshaft is now the default asset pipeline for Rails applications. It’s a modern, fast, and simple asset
    pipeline.
  • Kamal Rails 8.0 will generate a config/deploy.yml for Kamal deployments. This can be skipped with the --skip-kamal option.
  • New internal page for notes: a page at /rails/info/notes, that displays the same information as bin/rails notes.
  • Migrations not-null modifier: During migration generation you can use bang ! to add null: false to the column
    (e.g. bin/rails generate migration CreateUsers email_address:string!:uniq password_digest:string!).
  • Query log tags enabled by default in the development environment: This can be used to trace troublesome SQL statements back to the application code that generated these statements.
  • Deprecate bin/rake stats: Replaced with bin/rails stats.

Conclusion

From development to deployment, Rails 8.0 makes it easier to address common web development challenges. With Solid Trifecta, you can reduce the complexity of your stack and make it easier to maintain and scale your application. With Authentication, you can have a clear path to follow and understand what’s going on in your application which empowers you to make better decisions.

I’m excited to see what the community will build with Rails 8.0.

Happy coding and count on Codeminer42 if you need help migrating or introducing your team to Rails 8!

References

We want to work with you. Check out our "What We Do" section!

Source: blog.codeminer42.com

Related stories
2 weeks ago - Hello hello, today is the last Friday of September, but do not be sad, the latest Dev Weekly is out! Stay tuned to the coolest articles and tips of the tech world. Share it with your friends!
1 month ago - It's the 23rd of August and you are reading the 25th edition of the Codeminer42 weekly tech news report. Let's see what the tech world brought us this week!
14 hours ago - Inertia.js enables you to build SPAs with a traditional backend framework and a modern JavaScript frontend with server-side routing. The post Inertia.js adoption guide: Overview, examples, and alternatives appeared first on LogRocket Blog.
1 week ago - Docker hosting platform provides cloud infrastructure for users to deploy and manage Docker containers. This type of platform simplifies container scaling and offers an optimized environment for users to manage their containerized...
1 month ago - The rapid evolution of artificial intelligence (AI) has resulted in a powerful synergy between large language models (LLMs) and AI agents. This dynamic interplay is sort of like the tale of David and Goliath (without the fighting), where...
Other stories
2 hours ago - Fixes 41 bugs (addressing 595 👍). node:http2 server and gRPC server support, ca and cafile support in bun install, Bun.inspect.table, bun build --drop, iterable SQLite queries, iterator helpers, Promise.try, Buffer.copyBytesFrom, and...
7 hours ago - This guide provides a foundational understanding of Redux and why you should use it for state management in a React app. The post Understanding Redux: A tutorial with examples appeared first on LogRocket Blog.
9 hours ago - Discover some of the best Node.js web scraping libraries, including Axios and Superagent, and techniques for how to use them. The post The best Node.js web scrapers for your use case appeared first on LogRocket Blog.
12 hours ago - Infinite runner games have been a favorite for gamers and developers alike due to their fast-paced action and replayability. These games often feature engaging mechanics like endless levels, smooth character movement, and dynamic...
14 hours ago - Yesterday, Elizabeth Siegle, a developer advocate for CLoudflare, showed off a really freaking cool demo making use of Cloudflare's Workers AI support. Her demo made use of WNBA stats to create a beautiful dashboard that's then enhanced...