没有合适的资源?快使用搜索试试~ 我知道了~
首页Rails 5敏捷web开发指南:权威实战与深度解析
"《敏捷Web开发与Rails 5》是一本备受推崇的指南,专为想要掌握Ruby on Rails框架的开发者设计。作者以其丰富的经验和深入理解,提供了全面且实用的教学路径。该书的组织结构精心编排,前两部分通过实际项目构建,引导读者逐步了解如何在Rails 5环境中进行敏捷开发。书中包含的示例项目既易于理解,又展示了Rails框架的强大之处,对初学者和进阶开发者都极具价值。 Prathamesh Sonpatki,作为BigBinary的董事和Rails问题团队成员,高度评价这本书,认为其组织结构清晰,指导过程实用,尤其在构建应用程序和探讨Part III中的众多主题时表现出色。他不断推荐这本书给新入行的开发者,表明其在教学和实用性上的权威性。 Jeff Holland,一位资深软件工程师,对于《敏捷Web开发与Rails 5》的赞誉不吝溢美之词,称其为学习任何编程语言的最佳入门书籍,强调了其跨语言适用性和深度。 Charles Stran,作为产品工程和设计总监,表示这本书是他反复参考的重要资料,特别是在处理Rails项目时,它被公认为市场上最优秀的Rails教程之一。这进一步证实了其在专业领域的地位。 Stephen Orr,Siftware的高级开发人员,虽然提到电子版和纸质版的页码处理问题,但书的质量并未因此受影响。这表明尽管有小瑕疵,但内容的核心价值仍然得到认可。 《敏捷Web开发与Rails 5》凭借其详实的内容、实践导向的教学方法和广泛的适用性,在Rails 5时代的Web开发领域中占据了核心地位,是无论是新手还是经验丰富的开发者提升技能的不可或缺的参考资料。"
资源详情
资源推荐
![](https://csdnimg.cn/release/download_crawler_static/9780494/bg10.jpg)
learning curve. So while we’re still watching this, for the moment it remains
an advanced topic beyond the scope of this book. We’re confident that
those who find themselves needing this feature can find the material they
need online. More on this point later.
Turbolinks 3
Turbolinks 3, although technically a separate package, is something that
Rails applications depend on by default, so it might as well be considered
part of the core. So why isn’t it covered more?
Mostly because it’s too successful at being transparent. When it works,
you don’t have to think about it. It just makes things faster.
Prior editions of this book covered disabling Turbolinks when it got in the
way. This turns out not to be necessary for the scenarios in this book, so
Turbolinks has less coverage in this edition than in prior editions.
So what changes got comparatively more coverage?
• By far the change with the biggest impact is that all of the
rake
tasks have
been replaced by the
rails
command. For example,
rake test
has become
rails
test
. For the most part, this was a global search and replace. But what’s
notable is that it isn’t explicitly covered, because the target audience for
the book is people new to Rails, and spending a lot of time covering the
way things used to be isn’t helpful to them.
• Controller tests now are integration tests instead of essentially unit tests.
This also means that methods such as
assigns()
have been moved out of
Rails (but can still be added via the
rails-controller-testing
gem). Most definitely
not a simple search and replace, this change required many tests to be
completely rewritten. But again, the changes aren’t highlighted—the focus
of the book is on what works now.
• Synchronous mail delivery has been replaced by asynchronous mail
delivery. This is largely transparent to the application but required some
changes to the tests.
There were other changes. For example,
belongs_to
is now required by default.
This required one existing relationship to be changed to be explicitly marked
as optional. But the preceding features affected more pages.
So what does this mean to you, the reader?
It’s important to understand this book in the context of the web as it exists
today. The first edition of this book predated Stack Overflow, Hacker News,
GitHub, and many other resources that are available now. These days, if you
report erratum • discuss
Preface to the Rails 5 Edition • xv
![](https://csdnimg.cn/release/download_crawler_static/9780494/bg11.jpg)
know the right question to ask and know how to recognize the right answer,
you can go far.
This book embraces that reality. It realizes that the answers for Rails questions
are out there. It understands that the incubation period for Rails 5 was longer
than usual (Rails 4.2 was released in December of 2014, and Rails 4.0 was
released in June of 2013), so a plethora of documentation and answers (some
bad, most good, and some excellent) for new features in Rails is available.
What’s important to note is that you’re more likely to be led astray by slightly
stale examples of controller tests than you are by documentation of early
betas of Action Cable.
So if this book gives you the basics to build on, helps you phrase the right
answers, and helps you weed out the conflicting answers that you can find
online, then it’s done its job.
Before you proceed, a final word of caution. The Ruby language in general,
and the Rails web application framework in particular, tend to attract the
attention of people who are unrepentantly opinionated. And for some reason
this is particularly true when it comes to testing libraries. That’s fine; there’s
room for all. But be aware that the approach this book takes is to focus first
and foremost on the choices made by the Rails core team. Only when that’s
complete does it mention a few of the myriad choices available to you, and
how to find what you’re looking for.
Over time, you might find that you like one of those other choices better.
Should you come to that point, welcome to the club. You’ve become as opin-
ionated as the rest of us, and this book will have done its job.
Sam Ruby
rubys@intertwingly.net
September 2016
Preface to the Rails 5 Edition • xvi
report erratum • discuss
![](https://csdnimg.cn/release/download_crawler_static/9780494/bg12.jpg)
Acknowledgments
Rails is constantly evolving and, as it has, so has this book. Parts of the Depot
application were rewritten several times, and all of the text and code was
updated. The avoidance of features as they become deprecated has repeatedly
changed the structure of the book, as what was once hot became just lukewarm.
So, this book would not exist without a massive amount of assistance from
the Ruby and Rails communities. We had many helpful reviewers of drafts of
this edition:
Sage HamblinKosmas ChatzimichalisSefik Kanat Bolazar
Jeff HollandRod HiltonMichael Hansen
Nigel LowryAskarbek KarasaevBruce Jackon
Prathamesh SonpatkiNathan RuehsGraham Menhennitt
David WilburMasaki SuketaCharles Stran
Stephen Orr
Each edition of this book has been released as a beta book: early versions
were posted as PDFs, and people made comments online. And comment they
did; over time, more than fifty suggestions and bug reports were posted. The
vast majority ended up being incorporated, making this book immeasurably
more useful than it would otherwise have been. While thanks go out to all
for supporting the beta book program and for contributing so much valuable
feedback, one contributor in particular—Kosmas Chatzimichalis—went well
beyond the call of duty.
Finally, the Rails core team has been incredibly helpful, answering questions,
checking out code fragments, and fixing bugs—even to the point where part
of the release process includes verifying that new releases of Rails don’t break
the examples provided in this book.
Sam Ruby
report erratum • discuss
![](https://csdnimg.cn/release/download_crawler_static/9780494/bg13.jpg)
Introduction
Ruby on Rails is a framework that makes it easier to develop, deploy, and
maintain web applications. During the ten years since its initial release, Rails
went from being an unknown toy to being a worldwide phenomenon; more
important, it has become the framework of choice for the implementation of
a wide range of applications.
Why is that?
Rails Simply Feels Right
A large number of developers were frustrated with the technologies they were
using to create web applications. It didn’t seem to matter whether they used
Java, PHP, or .NET—there was a growing sense that their jobs were just too
damn hard. And then, suddenly, along came Rails, and Rails was easier.
But easy on its own doesn’t cut it. We’re talking about professional developers
writing real-world websites. They wanted to feel that the applications they
were developing would stand the test of time—that they were designed and
implemented using modern, professional techniques. So, these developers
dug into Rails and discovered it wasn’t just a tool for hacking out sites.
For example, all Rails applications are implemented using the Model-View-
Controller (MVC) architecture. Java developers are used to frameworks such
as Tapestry and Struts, which are based on MVC. But Rails takes MVC further:
when you develop in Rails, you start with a working application, there’s a
place for each piece of code, and all the pieces of your application interact in
a standard way.
Professional programmers write tests. And again, Rails delivers. All Rails
applications have testing support baked right in. As you add functionality to
the code, Rails automatically creates test stubs for that functionality. The
framework makes it easy to test applications, and as a result, Rails applica-
tions tend to get tested.
report erratum • discuss
![](https://csdnimg.cn/release/download_crawler_static/9780494/bg14.jpg)
Rails applications are written in Ruby, a modern, object-oriented scripting
language. Ruby is concise without being unintelligibly terse. You can express
ideas naturally and cleanly in Ruby code. This leads to programs that are
easy to write and (just as important) are easy to read months later.
Rails takes Ruby to the limit, extending it in novel ways that make a program-
mer’s life easier. This makes our programs shorter and more readable. It also
allows us to perform tasks that would normally be done in external configu-
ration files inside the codebase instead. This makes it far easier to see what’s
happening. The following code defines the model class for a project. Don’t
worry about the details for now. Instead, think about how much information
is being expressed in a few lines of code:
class Project < ApplicationRecord
belongs_to :portfolio
has_one :project_manager
has_many :milestones
has_many :deliverables, through: milestones
validates :name, :description, presence: true
validates :non_disclosure_agreement, acceptance: true
validates :short_name, uniqueness: true
end
Two other philosophical underpinnings keep Rails code short and readable:
DRY and convention over configuration. DRY stands for don’t repeat yourself.
Every piece of knowledge in a system should be expressed in one place. Rails
uses the power of Ruby to bring that to life. You’ll find little duplication in a
Rails application; you say what you need to say in one place—a place often
suggested by the conventions of the MVC architecture—and then move on.
For programmers used to other web frameworks, where a simple change to
the schema could involve a dozen or more code changes, this was a revelation.
Convention over configuration is crucial, too. It means that Rails has sensible
defaults for just about every aspect of knitting together your application.
Follow the conventions, and you can write a Rails application using less code
than a typical Java web application uses in XML configuration. If you need
to override the conventions, Rails makes that easy, too.
Developers coming to Rails found something else, too. Rails doesn’t merely
play catch-up with the de facto web standards; it helps define them. And
Rails makes it easy for developers to integrate features such as Ajax, RESTful
interfaces, and WebSockets into their code because support is built in. (And
if you’re not familiar with Ajax, REST interfaces, or WebSockets, never fear—
we’ll explain what these terms mean in Chapter 11, Task F: Add a Dash of
Ajax, on page 145 and REST: Representational State Transfer, on page 316.)
Introduction • xx
report erratum • discuss
剩余466页未读,继续阅读
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://profile-avatar.csdnimg.cn/b7b7741a2a694a118728282297f09f41_snoleo.jpg!1)
snoleo
- 粉丝: 0
- 资源: 5
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![](https://csdnimg.cn/release/wenkucmsfe/public/img/voice.245cc511.png)
最新资源
- 多模态联合稀疏表示在视频目标跟踪中的应用
- Kubernetes资源管控与Gardener开源软件实践解析
- MPI集群监控与负载平衡策略
- 自动化PHP安全漏洞检测:静态代码分析与数据流方法
- 青苔数据CEO程永:技术生态与阿里云开放创新
- 制造业转型: HyperX引领企业上云策略
- 赵维五分享:航空工业电子采购上云实战与运维策略
- 单片机控制的LED点阵显示屏设计及其实现
- 驻云科技李俊涛:AI驱动的云上服务新趋势与挑战
- 6LoWPAN物联网边界路由器:设计与实现
- 猩便利工程师仲小玉:Terraform云资源管理最佳实践与团队协作
- 类差分度改进的互信息特征选择提升文本分类性能
- VERITAS与阿里云合作的混合云转型与数据保护方案
- 云制造中的生产线仿真模型设计与虚拟化研究
- 汪洋在PostgresChina2018分享:高可用 PostgreSQL 工具与架构设计
- 2018 PostgresChina大会:阿里云时空引擎Ganos在PostgreSQL中的创新应用与多模型存储
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
![](https://img-home.csdnimg.cn/images/20220527035711.png)
![](https://img-home.csdnimg.cn/images/20220527035711.png)
![](https://img-home.csdnimg.cn/images/20220527035111.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![](https://csdnimg.cn/release/wenkucmsfe/public/img/green-success.6a4acb44.png)