百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
L

Layered-Design-for-Ruby-on-Rails-Applications

> 后端框架
开源

《Ruby on Rails 应用程序的分层设计》,由 Packt 出版

315 stars0 点赞3 次浏览
访问官网GitHub

工具介绍

《Ruby on Rails 应用程序的分层设计》,由 Packt 出版

Layered Design for Ruby on Rails Applications

Layered Design for Ruby on Rails Applications, published by Packt

This is the code repository for Layered Design for Ruby on Rails Applications, published by Packt.

Discover practical design patterns for maintainable web applications.

What is this book about?

Ruby on Rails is an open-source framework for building web applications from scratch and develop a full-featured product. This book helps you keep the code maintainable while working on a Rails application by demonstrating the useful design patterns and exploring the common code abstractions.

This book covers the following exciting features:

  • Discover Rails' core components and its request/response cycle
  • Understand Rails' convention-over-configuration principle and its impact on development
  • Explore patterns for flexibility, extensibility, and testability in Rails
  • Identify and address Rails’ anti-patterns for cleaner code
  • Implement design patterns for handling bloated models and messy views
  • Expand from mailers to multi-channel notification deliveries
  • Explore different authorization models and layers
  • Use a class-based approach to configuration in Rails

If you feel this book is for you, get your copy today!

Instructions and navigations

All of the code is organized into folders. For example, Chapter02.

The lib/ folder contains utilities to run code snippets. Most chapter folders also contain the prelude.rb file with the environment configuration for the examples (dependecies, Rails application configuration, database schema extensions, etc).

You can run any example using the ruby command, for example:

bash
$ ruby Chapter01/01-request-gc-stats.rb

Total allocations: 18573

Using examples runner

You can also run examples using a specific runner scripts, which prints the source code along with intermediate return values in addition to executing the code:

bash
ruby run.rb Chapter01/01-request-gc-stats.rb

Here is an example output of the runner:

Running Rails tasks

You can run Rails (Rake) tasks using the bin/rails executable:

bash
$ bin/rails middleware

use ActionDispatch::HostAuthorization
use Rack::Sendfile
...
use Rack::TempfileReaper
run App.routes

You can also load the application modification for a particular chapter by specifying the CHAPTER env var:

bash
$ CHAPTER=2 bin/rails routes

...
         books GET    /books(.:format)
    books#index
    categories GET    /categories(:format)
    categories#index
      category GET    /categories:id(.:format)
    categories#show

Finally, you can run a Rails server for a particular chapter (some chapters contain controllers and views examples). For example, for Chapter 7:

bash
$ CHAPTER=7 bin/rails rails s

[2023-01-30 22:45:37] INFO  WEBrick 1.8.1
[2023-01-30 22:45:37] INFO  ruby 3.2.0 (2022-12-25) [aarch64-linux]
[2023-01-30 22:45:37] INFO  WEBrick::HTTPServer#start: pid=1266 port=3000
...

Now you can open a web server at localhost:3000/users and play with the auto-generated Rails CRUD interface for users.

Software and Hardware List

Chapter Software required OS required
1-15 Ruby 3.2 Any OS that runs Ruby

Related products

  • Web Development with Julia and Genie [Packt] [Amazon]

  • Practical Module development for Prestashop 8 [Packt] [Amazon]

Get to Know the Author

Vladimir Dementyev is a principal backend engineer at Evil Martians, a product development consultancy from Earth, focusing on building maintainable web applications and developers’ productivity. He is the creator of popular open source tools, such as AnyCable and TestProf, and a contributor to many other open source projects, including Ruby on Rails and Ruby itself. Vladimir plays an active role in the Ruby community through his code contributions and by speaking at conferences and sharing his passion for coding via articles and blog posts. For his contributions to the Ruby ecosystem, Vladimir was awarded the Fukuoka Ruby Award in 2021 and the Ruby Hero Russia Award in 2017.

Issues· 2 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Rubyrubyruby-on-rails

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类后端框架
定价开源

> 相关工具

N
Node.js
基于 V8 的 JavaScript 运行时
D
Django
Python 高级 Web 框架
S
Spring Boot
Java 生态主流微服务框架