Skip to main content

2018 | Buch

Learn Rails 5.2

Accelerated Web Development with Ruby on Rails

insite
SUCHEN

Über dieses Buch

Learn to build Rails-based web applications using all the latest features offered in Rails 5.2. Author Stefan Wintermeyer begins by teaching the basics of Ruby 2.5 before proceeding through all aspects of Rails, utilizing clean, succinct examples – rather than a single large application.
This book covers topics including Active Storage, Credentials, Active Record, Scaffolding, REST, Routing, Bundler, Forms, Cookies, and Sessions, all of which are vital for modern Rails web applications. To complement these topics you’ll also learn about test-driven development, Action Cable, Active Job, Action Mailer, I18n, Asset Pipeline, and caching. Finally, you’ll see a how-to for a production web server with nginx. This complete set of skills will set you up for a future of efficient and elegant Rails coding.

What You Will LearnUse the Ruby on Rails web development framework
Install and manage the Rails framework
Persist data for your web application with Active Record
Work with forms
Apply a test-driven development approach to your Rails-based web applications
Discover many Rails secrets and tips
Who This Book Is For

Those with at least some prior programming experience. Ruby experience is helpful, but not required.

Inhaltsverzeichnis

Frontmatter
Chapter 1. Ruby Introduction
Abstract
This chapter is a tightrope walk between oversimplification and a degree of detail that is unnecessary for a Rails newbie. After all, the objective is not to become a Ruby guru but to understand Ruby on Rails. I will elaborate on the most important points, and the rest is then up to you. If you would like to know more about Ruby, I recommend the book The Ruby Programming Language by David Flanagan and Yukihiro Matsumoto.
Stefan Wintermeyer
Chapter 2. First Steps with Rails
Abstract
Now that you have painstakingly read your way through the basics of Ruby in Chapter 1, you can move on to a more exciting topic. In this chapter, you will create your first small Ruby on Rails project.
Stefan Wintermeyer
Chapter 3. ActiveRecord
Abstract
ActiveRecord is a level of abstraction that offers access to a SQL database. ActiveRecord implements the architectural pattern Active Record.
Stefan Wintermeyer
Chapter 4. Scaffolding and REST
Abstract
Scaffolding means simply that a basic scaffold for an application is created with a generator. This scaffold not only contains the model but also a simple web GUI (views) and of course a controller. The programming paradigm used for this is Representational State Transfer (REST).
Stefan Wintermeyer
Chapter 5. Routes
Abstract
In Chapters 2 and 4, you learned about routes. The configuration in config/routes.rb defines what happens in the Rails application when a user of a Rails application fetches a URL. A route can be static and dynamic and pass any dynamic values with variables to the controller. If several routes apply to the same URL, the one that is listed at the top of config/routes.rb wins.
Stefan Wintermeyer
Chapter 6. Bundler and Gems
Abstract
Gems are how you do package management in the world of Ruby.
Stefan Wintermeyer
Chapter 7. Forms
Abstract
In this chapter, I’ll talk about forms.
Stefan Wintermeyer
Chapter 8. Cookies and Sessions
Abstract
In this chapter, I’ll talk about cookies and sessions.
Stefan Wintermeyer
Chapter 9. Tests
Abstract
I have been programming for more than 30 years, and most of the time I have managed quite well without test-driven development (TDD). I am not going to be mad at you if you decide to just skip this chapter. You can create Rails applications without tests, and you are not likely to garner any bad karma as a result (at least, I hope not, but you can never be entirely sure with the whole karma thing).
Stefan Wintermeyer
Chapter 10. Active Job
Abstract
Sometimes a specific piece of code takes a long time to run but doesn’t need to run right away. An example is sending an e-mail after creating an order at the end of an online shopping workflow. It can take a long time to send an e-mail, but you don’t want your user to wait for that to happen within the controller. It makes more sense to use a queueing mechanism for these tasks.
Stefan Wintermeyer
Chapter 11. Action Mailer
Abstract
Even if you mainly use Ruby on Rails to generate web pages, it sometimes is useful to be able to send an e-mail.
Stefan Wintermeyer
Chapter 12. Internationalization
Abstract
If you are in the lucky situation of creating web pages in English only, then you can skip this chapter completely.
Stefan Wintermeyer
Chapter 13. Asset Pipeline
Abstract
The asset pipeline offers Rails developers the opportunity to deliver CSS, JavaScript, and image files to the browser more optimally. Depending on the type of file, this can be through compression or a file name fingerprint. Different CSS files are combined into one big file. The fingerprinting enables the browser and any proxy in between to optimally cache the data so the browser can load these files more quickly on subsequent visits.
Stefan Wintermeyer
Chapter 14. Caching
Abstract
With the caching of web applications, most people tend to wait to implement it until they encounter performance problems. First the admin usually looks at the database and adds an index here and there. If that does not help, the admin then takes a look at the views and adds fragment caching. But this is not the best approach for working with caches. The aim of this chapter is to help you understand how key-based cache expiration works. You can then use this approach to plan new applications already on the database structure level in such a way that you can cache optimally during development.
Stefan Wintermeyer
Chapter 15. Action Cable
Abstract
Most modern web pages are not just static. They often get updates from the server without interaction from the user. For example, your Twitter or Gmail browser client will display new tweets or e-mails without you reloading the page.
Stefan Wintermeyer
Chapter 16. Credentials
Abstract
You normally don’t want to commit them unencrypted to your repository, but you also want to share them with other developers. Rails 5.1 introduced the concept of secrets, but Rails 5.2 deprecated them and introduced the concept of credentials.
Stefan Wintermeyer
Chapter 17. Active Storage
Abstract
Not only can Active Storage store files, but it can also convert and resize them. In this chapter, I will show you how to attach a file to give you the basic idea of how Active Storage works.
Stefan Wintermeyer
Backmatter
Metadaten
Titel
Learn Rails 5.2
verfasst von
Stefan Wintermeyer
Copyright-Jahr
2018
Verlag
Apress
Electronic ISBN
978-1-4842-3489-1
Print ISBN
978-1-4842-3488-4
DOI
https://doi.org/10.1007/978-1-4842-3489-1