Beginning Rails 4 (3rd Edition) - Cloves Carneiro Jr.pdf
(
4261 KB
)
Pobierz
For your convenience Apress has placed some of the front
matter material after the index. Please use the Bookmarks
and Contents at a Glance links to access them.
Contents at a Glance
About the Authors�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½
xvii
About the Technical Reviewer �½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½
xix
Introduction �½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½
xxi
■
Chapter 1: Introducing the Rails Framework �½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½1
■
Chapter 2: Getting Started �½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½13
■
Chapter 3: Getting Something Running �½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½27
■
Chapter 4: Introduction to the Ruby Language �½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½45
■
Chapter 5: Working with a Database: Active Record �½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½61
■
Chapter 6: Advanced Active Record: Enhancing Your Models �½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½81
■
Chapter 7: Action Pack: Working with the View and the Controller �½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½121
■
Chapter 8: Advanced Action Pack �½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½151
■
Chapter 9: JavaScript and CSS �½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½191
■
Chapter 10: Sending and Receiving E-Mail �½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½203
■
Chapter 11: Testing Your Application �½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½219
■
Chapter 12: Internationalization�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½251
■
Chapter 13: Deploying Your Rails Applications �½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½267
■
Appendix A: Databases 101 �½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½273
■
Appendix B: The Rails Community�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½281
■
Appendix C: Git �½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½285
Index �½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½297
v
Introduction
What Is This Book About?
In the past several years, the Web has exploded to include information on every facet of our lives. It touches everything
we do; even some refrigerators have included access to the Internet. Ruby on Rails has played a part in fueling
that explosion. This book will equip you with the knowledge you need to build real production web applications.
It leads you through installing the required prerequisites on Windows, OS X, or Linux and then jumps straight into
building applications. It is meant for the novice programmer who has some command line experience but little or no
programming experience. At the end of the book, you should have a firm grasp on the Ruby language and the Rails
framework.
Chapter 1 introduces you to the current web landscape and then goes over some of the ideals and principles that
the Rails framework is built on. It teaches you about the MVC paradigm and shows how Rails implements each piece
of that paradigm (model, view, and controller).
Chapter 2 walks you through installing Ruby, Rails, and the SQLite database. It is broken down by operating
system, and when finished, will give a level platform among all three. You should be able to follow along with the book
no matter which platform you choose. It also will show you how to build a quick “Hello World” application to make
sure everything is working correctly.
Chapter 3 dives right in and starts the blog application that we’ll use throughout the rest of the book. We’ll
continually build on this application, enhancing and refactoring as we go along. You’ll create your first model in this
chapter, the article model. We’ll cover how migrations work and even get Rails to construct our first scaffold. At the
end of this chapter, you’ll have a working blog application, although it will be lacking features. We’ll add those in the
following chapters.
Chapter 4 slows down a little bit from the previous chapter and takes you on a tour of the Ruby language. If you’ve
used Ruby for a while and feel comfortable with it, feel free to skim over this. If you’re new to Ruby, this chapter will
teach you everything you need to know to use Rails. Ruby is an easy to pick up language, and the syntax is very inviting
and easy to read. Although we won’t add any code to our blog application here, you will get to use the Ruby language
inside the Ruby console.
Chapter 5 shows you how Rails uses Active Record to let you interact with any number of databases. Rails
abstracts away the difficult bits (unless you need them) and lets you interact with databases in an object-oriented way.
You’ll learn how to create new records, find records, and even update and delete them. We’ll also apply some basic
validations so we can be sure our data are just the way they should be.
Chapter 6 expounds on the previous chapter. You’ll dive deeper into Active Record and your models. You will
build more complex validations and custom instance methods. A major component of this chapter is the relation
between your models and how Rails lets you define those relations. Your models for the blog application will have
complex relations and validations.
In Chapter 7 we’ll cover the view and controller parts of MVC. We will flesh out the blog application and walk
through the code that Rails generated for the scaffold of our controllers and views.
Chapter 8 modifies the controller and views in more advanced ways, and at this point the features of our blog
application have come together. You’ll learn about controller callbacks and strong parameters that were added in
Rails 4. We’ll also give our application a fresh coat of paint with some Cascading Style Sheets (CSS).
xxi
■
IntroduCtIon
Chapter 9 goes over the Asset Pipeline that was added in Rails 3.2 and how to add JavaScript and CSS. We’ll
enhance our application with JavaScript dabbling in Ajax and animation. This chapter covers CoffeeScript and SASS
and how they integrate into the Rails landscape. At the end of this chapter, your application will have a nice layer of
spit and polish.
Chapter 10 adds e-mail capability to our application. You will be able to suggest articles to friends and even be
notified when your article has new comments. It will also discuss methods to receive e-mail into your application.
Chapter 11 covers one of the most important topics in Rails applications: testing. You can be sure that after this
chapter you’ll be able to add new features without breaking old ones. You’ll test whether your application behaves
exactly the way you think it should.
Chapter 12 covers internationalization. After all, it is the World Wide Web, and not everyone speaks the same
language. We’ll translate our web application into another language, and along the way you’ll learn how to translate
the application into as many languages as you like.
Chapter 13 will show you how to deploy your web application to Heroku, one of the leading Platform As A Service
(PAAS) providers. This will allow you to present your application to the world quickly and easily so you can start
building a user base.
The three appendices cover the Git version control system, SQL, and where to find help in the Rails community.
xxii
Plik z chomika:
jonedave3
Inne pliki z tego folderu:
B-29 Superfortress vs Ki-44 - Donald Nijboer.epub
(25672 KB)
B-17 Flying Fortress Units of t - William Hess.epub
(18102 KB)
B00XANZZ4A_EBOK_nodrm.azw3
(31349 KB)
B.R. Bhagwat - Mahabharata.azw3
(20673 KB)
B A Paris - Behind Closed Doors_nodrm.epub
(2167 KB)
Inne foldery tego chomika:
@other-lang
@packed
0
1
2-1
Zgłoś jeśli
naruszono regulamin