Active Rails
- Length: 522 pages
- Edition: 1
- Language: English
- Publisher: Leanpub
- Publication Date: 2021-02-13
Learn how to build a production-quality Rails 6 application from the ground up. Complete with TDD / BDD examples. Just like we do in the real world!
This book will teach you the fundamentals of building a Rails application from the ground-up, complete with strict adherence to TDD and BDD.
Earlier editions of this book have been used by thousands of people to help their Ruby on Rails careers.
This book will show you how to build a fully-featured Rails 6 application that includes:
- CSS styles
- Authentication & Authorization
- File uploading
- Sending & receiving email
- Deployment
This book follows community-approved standards of developing a Rails application. We use RSpec and Capybara for testing, Bootstrap for styling, and Devise for authentication. There’s also Active Storage for file loading, Action Mailer for sending email and Heroku for deployment.
Knowledge pre-requisites
This book assumes knowledge of HTML, CSS and some Ruby. No Rails knowledge is required for this book; we’ll teach you what you need to know!
Active Rails Preface Author Introductions Ryan Bigg Acknowledgements About this book Who should read this book What’s new in the third edition Roadmap 1. Ruby on Rails, the framework 1.1. Ruby on Rails overview Benefits Ruby Gems MVC Rails in the wild 1.2. Rails from first principles Installing Rails Generating an application Starting the application Getting started with Rails Scaffolding Migrations Creating a purchases table Viewing purchases Creating a purchase The first half of the form partial The second half of the form partial Validations Showing off Updating purchases Deleting 1.3. Takeaways Rails is a conventions-based framework The five main pillars of a Rails application The scaffold generator gives us a lot 1.4. Summary 2. Writing automated tests 2.1. Installing and setting up RSpec 2.2. Writing our first feature test 2.3. Writing a second scenario 2.4. Takeaway 2.5. Summary 3. Developing a real Rails application 3.1. First steps The application story Laying the foundations 3.2. Version control Getting started with GitHub Configuring your Git client 3.3. Application configuration The Gemfile and generators Rails application environments Starting with Behavior Driven Development Database configuration 3.4. Beginning your first feature Creating projects Defining a controller action RESTful routing Of models and migrations Form building Creating the create action Strong parameters The application layout Committing changes Setting a page title Validations Adding validations 3.5. Takeaways Behavior Driven Development Version Control You can build Rails apps without scaffold 3.6. Summary 4. Oh, CRUD! 4.1. Viewing projects Introducing Factory Bot Adding a link to a project 4.2. Editing projects The edit action The update action Defining behaviour for when an update fails 4.3. Deleting projects 4.4. What happens when things can’t be found Handling the ActiveRecord::RecordNotFound exception 4.5. Summary 5. Nested resources 5.1. Creating tickets Nested routing helpers Creating a tickets controller Demystifying the new action Defining a has_many association Creating tickets in a project Finding tickets scoped by project Ticket validations 5.2. Viewing tickets Listing tickets Culling tickets 5.3. Editing tickets The "Editing tickets" spec Adding the edit action Adding the update action 5.4. Deleting tickets 5.5. Summary 6. Styling the application 6.1. Installing Bootstrap 6.2. Improving the page’s header Positioning actions with custom CSS Applying the style elsewhere Improving the show view 6.3. Semantic styling Styling buttons Styling headers Styling flash messages 6.4. Using Bootstrap Form Updating the styling of the project form Updating the styling of the ticket form 6.5. Adding a navigation bar 6.6. More responsive styling 7. Authentication 7.1. Using Devise 7.2. Adding sign up 7.3. Adding sign in and sign out Adding sign out Styling the Devise views 7.4. Linking tickets to users Fixing the failing features 7.5. Summary 8. Basic access control 8.1. Turning users into admins Adding the admin field to the users table Creating the first admin user 8.2. Controller namespacing Generating a namespaced controller Testing a namespaced controller Moving functionality into the admin namespace The creating projects feature The updating projects feature The deleting projects feature 8.3. Hiding links Hiding the "New Project" link Hiding the edit and delete links 8.4. Namespace-based CRUD The index action Listing users The new action The create action Creating admin users Editing users The edit and update actions Archiving users Ensuring that you can’t archive yourself Preventing archived users from signing in 8.5. Summary 9. File uploading 9.1. Attaching a file A feature featuring files Enter stage right, Active Storage Using Active Storage Implementing multiple-file upload JavaScript testing 9.2. Summary 10. Tracking state 10.1. Leaving a comment The comment form The comment model The comments controller 10.2. Changing a ticket’s state Creating the State model Selecting states Setting a default state for a comment Seeding states 10.3. Tracking changes Ch-ch-changes Displaying changes Styling states 10.4. Managing states Adding additional states Defining a default state Applying the default state Setting a default state in seed states 10.5. Summary 11. Sending email 11.1. Sending ticket notifications Automatically watching a ticket Defining the watchers association You’re not really sending emails Using service classes Introducing Action Mailer An Action Mailer template 11.2. Testing with mailer specs 11.3. Previewing emails 11.4. HTML emails Styling HTML emails 11.5. Subscribing to updates Testing comment subscription Automatically adding the commenter to the watchlist Unsubscribing from ticket notifications 11.6. Summary 12. Tagging 12.1. Creating tags The "Creating Tags" feature Showing tags Defining the tags association The Tag model Displaying a ticket’s tags 12.2. Editing tags Displaying existing tags Adding tags to an existing ticket A quick refactor 12.3. Deleting a tag Testing tag deletion Adding a link to delete the tag Removing the tag from the page 12.4. Finding tags Testing search Searching by tags Searching by state Search, but without the search 12.5. Summary 13. Deployment 13.1. What is deployment? 13.2. Simple deployment with Heroku Signing up Provisioning an app 13.3. Twelve-factor apps Configuration Processes Configuring your S3 Credentials 13.4. Deploying Ticketee Fixing deployment issues Deploying is hard 13.5. Continuous deployment with GitHub Actions Configuring GitHub Actions Continuous Deployment with Heroku 13.6. Background jobs 13.7. Sending emails 13.8. Summary Appendix A: Installation Guide Windows RubyInstaller Node.js + Yarn Yarn Git Rails Databases Starting a Rails application Mac OS X Homebrew asdf Installation Ruby Node Yarn Rails Starting a new Rails app Linux build-essential Git asdf Installation Ruby Node Yarn Rails Starting a new Rails app Appendix B: Why Rails? Reason #1: The sense of community Reason #2: The speed and ease of development Reason #3: RubyGems Reason #4: Emphasis on Testing
Donate to keep this site alive
1. Disable the AdBlock plugin. Otherwise, you may not get any links.
2. Solve the CAPTCHA.
3. Click download link.
4. Lead to download server to download.