没有合适的资源?快使用搜索试试~ 我知道了~
首页第四版Rails敏捷Web开发指南:兼容与升级注意事项
"《敏捷Web开发与Rails (第4版)》是一本专注于Ruby on Rails框架的教程,适用于Rails 3版本。作者们强调了随着Rails核心团队的持续更新,读者在安装和运行本书提供的示例时,确保使用最新版本的Rails至关重要。书中第1章“安装Rails”(第24页)提供了安装指导,以便于遵循兼容性要求。 书中提到,由于新版本可能会引入与旧版本不兼容的地方,如代码更改,所以通过命令行工具`rails -v`检查当前Rails版本是非常重要的。对于可能影响本书内容的Rails更新信息,可以参考Pragprog网站的“Changes To Rails”wiki页面。 作者们分享了自己的经验和推荐,Sam、Dave和David在Rails初学阶段阅读了第一版,被其全面的Rails框架理解和社区介绍深深吸引,这使他们能够在Rails开发领域取得成功。随着第四版的发布,他们证实这本书依然保持了一贯的高质量,是他们向新入行的Rails开发者首推的教材。 Mikel Lindsaar作为Rails核心团队的贡献者,Ruby Mail库的创建者,以及RubyX的负责人,他的认可进一步证明了《敏捷Web开发与Rails (第4版)》在Rails技术领域的权威性和实用性。这本书是学习和掌握Rails框架的最佳指南,帮助开发者紧跟框架的发展,实现高效、敏捷的Web开发。"
资源详情
资源推荐
![](https://csdnimg.cn/release/download_crawler_static/9082567/bg10.jpg)
Intr oduction
Ruby on Rails is a framework that makes it easier to develop, deploy, and
maintain web applications. During the months that followed its initial release,
Rails went from being an unknown toy to being a worldwide phenomenon, and
more important, it has become the framework of choice for the implementation
of a wide range of so-called Web 2.0 applications.
Why is that?
Rails Simply Feels Right
First, a large number of developers were frustrated with the te chnologies they
were using to cr eate web applications. It didn’t seem to matter whether they
were using Java, PHP, or .NET—there was a growing sense that their job was
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, pr of essional 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 st art 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 appli-
cations have testing support baked right in. As you add functionality to the
code, Rails automatically creates test stubs for that f unctionality. The frame-
work makes it easy to test applications, and as a result, Rails applications
tend to get tested.
![](https://csdnimg.cn/release/download_crawler_static/9082567/bg11.jpg)
RAILS SIMPLY FEELS RIGHT 17
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 re ad mo nths later.
Rails takes Ruby to the limit, extending it in novel ways that make a pro-
grammer’s life easier. This makes our programs shorter and more readable.
It also allows us to perfor m tasks that would normally be done in external
configuration 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, just think about how much
information is being expressed in a few lines of code.
class Project < ActiveRecord::Base
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 just one place.
Rails uses the power of Ruby to bring that to life. You’ll find very little duplica-
tion 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 them in half a dozen or more code changes, this
was a revelation.
Convention over configuration is crucial, too. It means that Rails has sensi-
ble 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 isn’t playing catch-
up with the new de facto web standards; it’s helping define them. And Rails
makes it easy for developers to integrate features such as Ajax and RESTful
interfaces into their code, because support is built in. (And if you’re not famil-
iar with Ajax and REST interfaces, never fear—we’ll explain them later in the
book.)
Report erratum
this copy is (P1.0 printing, March 2011)
![](https://csdnimg.cn/release/download_crawler_static/9082567/bg12.jpg)
RAILS IS AGILE 18
Developers are worried about deployment too. They found that with Rails you
can deploy successive releases of your application to any number of servers
with a single command (and roll them back equally easily should the release
prove to be somewhat less than perfect).
Rails was extracted f rom a real-world, commer c ial application. It turns out
that the best way to create a framework is to find the central themes in a
specific application and then bottle them up in a generic f oundation of code.
When you’re developing your Rails application, you’re starting with half of a
really good application already in place.
But there’s something else to Rails—something that’s hard to describe. Some-
how, it just feels right. Of course, you’ll have to take our word for that until
you write some Rails applications for yourself (which should be in the next
forty-five m inutes or so. .. ). That’s what this book is all about.
Rails Is Agile
The title of this book is Agile Web Development with Rails. You may be sur-
prised to discover that we don’t have explicit sections on applying agile prac-
tices X, Y, and Z to Rails coding.
The reason is both simple and subtle. Agility is part of the fabric of Rails.
Let’s look at the values expressed in the Agile Manifesto as a set of four pref-
erences:
1
• Individuals and interactions over processes and tools
• Working software over comprehensive documentation
• Customer collaboration over contract negotiation
• Responding to change over following a plan
Rails is all about individuals and interactions. There are no heavy toolsets,
no complex configurations, and no elaborate processes. There are just small
groups of developers, their favorite editors, and chunks of Ruby c ode. This
leads to transparency; what the developers do is reflected immediately in what
the customer sees. I t’s an intrinsically interactive process.
Rails doesn’t denounce documentation. Rails makes it trivially easy to cre-
ate HTML documentation for y our entire codebase. But the Rails development
process isn’t driven by documents. You won’t find 500-page specifications at
the heart of a Rails project. Instead, you’ll find a group of users and devel-
opers jointly exploring their need and the possible ways of answering that
need. You’ll find solutions that change as both the developers and the users
become more experienced with the problems they’re trying to solve. You’ll find
1. htt p://agilemanifesto.org/. Dave Thomas was one of the seventeen authors of this document.
Report erratum
this copy is (P1.0 printing, March 2011)
![](https://csdnimg.cn/release/download_crawler_static/9082567/bg13.jpg)
WHO THIS BOOK IS FOR 19
a framework that delivers working software early in the development cycle.
This software may be rough around the edges, but it lets the users start to get
a glimpse of what yo u’ll be delivering.
In this way, Rails encourages customer collaboration. When customers see
just how quickly a Rails project can respond to change, they start to trust
that the team can deliver what’s required, not just what has been requested.
Confrontations are replaced by “What if?” sessions.
That’s all tied to the idea of being able to respond to change. The strong, almost
obsessive, way that Rails honors the DRY principle means that changes to
Rails applications impact a lot less code than the same changes would in ot her
frameworks. And since Rails applications are written in Ruby, where concepts
can be expressed accurately and concisely, changes tend to be localized and
easy to write. The deep emphasis on both unit and functional testing, along
with support for test fixtures and stubs during testing, gives developers the
safety net they need when making those changes. With a good set of tests in
place, changes are less nerve-racking.
Rather than constantly trying to tie Rails processes to the agile principles,
we’ve decided to let the framework speak for itself. As you read through the
tutorial chapters, try to imagine yourself developing web applications this way:
working alongside your customers and jointly determining priorities and solu-
tions to pr oblem s. Then, as you read the more advanced concepts that follow
in Part III, see how the underlying structure of Rails can enable you to meet
your customers’ needs f aste r and with less ceremony.
One last point about agility and Rails: although it’s probably unprofessional
to mention this, think how m uch fun the coding will be.
Who This Book Is For
This book is for programmers looking to build and deploy web-based applica-
tions. This includes application programmers who are new to Rails (and per-
haps even new to Ruby) and ones who are familiar with the basics but want a
more in-depth understanding of Rails.
We presume some familiarity with HTML, Cascading Style Sheets (CSS), and
JavaScript, in other words, the ability to view source on web pages. You do not
need to be an expert on these subjects; the most you will ever be expected to do
is to copy and paste m ater ial from the book, all of which can be downloaded.
How To Read This Book
The first part of this book makes s ure you are ready. By the time you are done
with it, you will have been introduced to Ruby (the language), you will have
Report erratum
this copy is (P1.0 printing, March 2011)
![](https://csdnimg.cn/release/download_crawler_static/9082567/bg14.jpg)
HOW TO READ THIS BOOK 20
been exposed to an overview of Rails itself, you will have both Ruby and Rails
installed, and you will have verified t his installation with a simple example.
The next part takes you through the concepts behind Rails via an extended
example; we build a simple online store. It doesn’t take you one by one through
each component of Rails (“here is a chapter on models, here is a chapter on
views,” and so forth). These components are designed to work together, and
each chapter in this section tackles a specific set of related tasks that involve
a number of these components working together.
Most folks seem to enjoy building the application along with the book. If you
don’t want to do all that typing, you can cheat and download the source code
(a compressed tar archive or a zip file).
2
The third part of the book, starting on page
258, surveys the entire Rails
ecosystem. This starts with the functions and facilities of Rails that you will
now be familiar with. It then covers a number of key dependencies that the
Rails framework makes use of that contribute directly to the overall function-
ality that the Rails framework delivers. Finally, there is a survey of a number
of popular plugins that augment the Rails framework and make Rails an open
ecosystem rather than merely a framework.
Along the way, you’ll see various conv entions we’ve adopted.
Live Code
Most of the code snippets we show come from full-length, running exam-
ples that you can download. To help you find your way, if a code listing
can be found in the download, there’ll be a bar before the snippet (just
like the one here).
Download work/demo1/app/controllers/say_controller.r b
class SayController < ApplicationController
def hello
end
def
goodbye
end
end
This contains the path to the code within the download. If you’re reading
the ebook version of this book and your ebook viewer supports hyper-
links, you can click the bar, and the code should appear in a browser
window. Some br owser s (such as Safari) will mistakenly try to interpret
some of the templates as HTML. If this happens, view the source of the
page to see the real source code.
2. htt p://pragprog.com/titles/rails4/source_code has the links for the downloads.
Report erratum
this copy is (P1.0 printing, March 2011)
剩余456页未读,继续阅读
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.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://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://profile-avatar.csdnimg.cn/default.jpg!1)
qq_29714919
- 粉丝: 0
- 资源: 2
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![](https://csdnimg.cn/release/wenkucmsfe/public/img/voice.245cc511.png)
最新资源
- AirKiss技术详解:无线传递信息与智能家居连接
- Hibernate主键生成策略详解
- 操作系统实验:位示图法管理磁盘空闲空间
- JSON详解:数据交换的主流格式
- Win7安装Ubuntu双系统详细指南
- FPGA内部结构与工作原理探索
- 信用评分模型解析:WOE、IV与ROC
- 使用LVS+Keepalived构建高可用负载均衡集群
- 微信小程序驱动餐饮与服装业创新转型:便捷管理与低成本优势
- 机器学习入门指南:从基础到进阶
- 解决Win7 IIS配置错误500.22与0x80070032
- SQL-DFS:优化HDFS小文件存储的解决方案
- Hadoop、Hbase、Spark环境部署与主机配置详解
- Kisso:加密会话Cookie实现的单点登录SSO
- OpenCV读取与拼接多幅图像教程
- QT实战:轻松生成与解析JSON数据
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
![](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)