Customizing Rails in Other Ways

Customizing the edges of Rails, like you did above with CSS, HTML templates, and tests, tends to be more straightforward and more options are out there for you. Customizing Rails’ internals is more difficult. If you want, you can remove Active Record entirely and use libraries like Sequel or ROM,[118][119] but you’d be giving up a lot—Active Record is tightly coupled with many parts of Rails.

Tight coupling is usually viewed as a problem, but it’s this coupling that allows you to be so productive using Rails. The more you change your Rails app into a loosely coupled assembly of unrelated libraries, the more work you have to do getting the pieces to talk to each other. Finding the right balance is up to you, your team, or your project.

The Rails ecosystem is also filled with plugins and enhancements to address common needs that aren’t quite common enough to be added to Rails itself. For example, Kaminari provides pagination for when you need to let a user browse hundreds or thousands of records.[120] Ransack and Searchkick provide advanced ways of searching your database with Active Record.[121][122] CarrierWave makes uploading files to your Rails app much more straightforward than hand-rolling it yourself.[123]

And if you want to analyze and improve the code inside your Rails app, RuboCop can check that you are using a consistent style,[124] while Brakeman can check for common security vulnerabilities.[125]

These extras are the tip of the iceberg. The community of extensions and plugins for Rails is yet another benefit to building your next web application with Rails.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.137.181.66