
From PHP to Ruby on Rails
Description
Alles über E-Books | Antworten auf Fragen rund um E-Books, Kopierschutz und Dateiformate finden Sie in unserem Info- & Hilfebereich.
- Gain practical experience and proficiency in Ruby by contrasting PHP examples with their equivalent Ruby counterparts
- Explore how Ruby integrates into the Ruby on Rails framework and make insightful comparisons with PHP frameworks
- Purchase of the print or Kindle book includes a free PDF eBook
Book DescriptionAre you a PHP developer looking to take your first steps into the world of Ruby development? From PHP to Ruby on Rails will help you leverage your existing knowledge to gain expertise in Ruby on Rails. With a focus on bridging the gap between PHP and Ruby, this guide will help you develop the Ruby mindset, set up your local environment, grasp the syntax, master scripting, explore popular Ruby frameworks, and find out about libraries and gems. This book offers a unique take on Ruby from the perspective of a seasoned PHP developer who initially refused to learn other technologies, but never looked back after taking the leap. As such, it teaches with a language-agnostic approach that will help you feel at home in any programming language without learning everything from scratch. This approach will help you avoid common mistakes such as writing Ruby as if it were PHP and increase your understanding of the programming ecosystem as a whole. By the end of this book, you'll have gained a solid understanding of Ruby, its ecosystem, and how it compares to PHP, enabling you to build robust and scalable applications using Ruby on Rails.What you will learn - Set up a robust development environment by configuring essential tools and dependencies
- Understand the MVC model and learn effective techniques for working with Ruby libraries and frameworks
- Integrate authentication functionality into your Rails application by leveraging gems
- Find out how to process data from forms, URLs, and sessions within a Ruby on Rails application
- Gain proficiency in using functions and gems for debugging and troubleshooting your Rails project
- Create a simple Rails application, run it, and debug it in production mode
Who this book is forThis book is for PHP developers new to Ruby and Ruby on Rails. Whether you're a seasoned PHP developer or just starting out, this book will show you how you can transfer your existing PHP knowledge to Ruby and build web applications using the powerful Ruby on Rails framework.
All prices
More details
Other editions
Additional editions

Content
- Cover
- Title Page
- Copyright and Credits
- Dedication
- Contributors
- Table of Contents
- Part 1: From PHP to Ruby Basics
- Chapter 1: Understanding the Ruby Mindset and Culture
- Technical requirements
- Ruby is meant to be read as sentences
- Everything is an object
- Transitioning to Ruby
- Summary
- Chapter 2: Setting Up Our Local Environment
- Technical requirements
- Installing Ruby locally
- macOS users
- Windows users
- Linux users
- Using a virtual machine
- VMware
- VirtualBox
- Vagrant
- Using Docker
- Using rbenv
- Summary
- Chapter 3: Comparing Basic Ruby Syntax to PHP
- Technical requirements
- Running Ruby code from the command line
- Running a simple code file
- Loading a source code file with the load method
- Loading a source code file with the require method
- Ruby classes and modules
- The include method
- Interactive Ruby Shell (IRB)
- Exploring types of variables
- Arrays
- Hashes
- Symbols
- Using conditional statements
- The if statement
- The if-else statement
- The ternary operator
- Repeating code with loops
- Using Ruby language enhancements
- The unless sentence
- The until loop
- Automatic returns
- Optional parentheses
- Questionable exclamation method names
- Summary
- Chapter 4: Ruby Scripting versus PHP Scripting
- Technical requirements
- Beyond Hello World
- Text handling
- The upcase method
- The downcase method
- The capitalize method
- File manipulation
- The split() method
- The map() method
- The join() method
- Creating and modifying file contents
- Command-line arguments
- User input
- Putting it all together
- Summary
- Chapter 5: Libraries and Class Syntax
- Technical requirements
- Let's get ready to bundle!!!
- Installing a gem
- Gemfile versus composer.json
- Integrating libraries into your code in Ruby
- Declaring classes in Ruby
- Objects in Ruby
- Attribute accessors
- Inheritance in Ruby
- Summary
- Chapter 6: Debugging Ruby
- Technical requirements
- Debugging functions in Ruby versus PHP
- Gems for debugging
- The debug gem
- The pry gem
- The byebug gem
- Understanding IRB's usefulness
- Summary
- Part 2: Ruby and the Web
- Chapter 7: Understanding Convention over Configuration
- Technical requirements
- If there is Ruby magic, there is Rails magic
- Installing Ruby on Rails
- Starting our Ruby on Rails project
- Rails file structure explained
- MVC at its finest
- POST, GET, and SESSION in Rails
- Summary
- Chapter 8: Models, DBs, and Active Record
- Technical requirements
- Generating models using Rails
- Rails migrations
- Connecting to a database
- The Rails console
- Active Record operations
- Creating records
- Selecting record(s)
- Updating records
- Deleting record(s)
- Summary
- Chapter 9: Bringing It All Together
- Technical requirements
- Project preparation
- Setting up our application
- Processing data
- Setting up the CRUD interface
- Listing data
- Updating data
- Creating data
- Deleting data
- Do not, I repeat, do not repeat yourself
- Summary
- Chapter 10: Considerations for Hosting Rails Applications versus PHP Applications
- Technical requirements
- PHP versus Rails in terms of price
- DIY or have it done for you
- Why nginx?
- Error gossip and last words
- Summary
- Index
- Other Books You May Enjoy
System requirements
File format: ePUB
Copy protection: Adobe-DRM (Digital Rights Management)
System requirements:
- Computer (Windows; MacOS X; Linux): Install the free reader Adobe Digital Editions prior to download (see eBook Help).
- Tablet/smartphone (Android; iOS): Install the free app Adobe Digital Editions or the app PocketBook before downloading (see eBook Help).
- E-reader: Bookeen, Kobo, Pocketbook, Sony, Tolino and many more (not Kindle).
The file format ePub works well for novels and non-fiction books – i.e., „flowing” text without complex layout. On an e-reader or smartphone, line and page breaks automatically adjust to fit the small displays.
This eBook uses Adobe-DRM, a „hard” copy protection. If the necessary requirements are not met, unfortunately you will not be able to open the eBook. You will therefore need to prepare your reading hardware before downloading.
Please note: We strongly recommend that you authorise using your personal Adobe ID after installation of any reading software.
For more information, see our ebook Help page.
File format: ePUB
Copy protection: without DRM (Digital Rights Management)
System requirements:
- Computer (Windows; MacOS X; Linux): Use a reader that can handle the file format ePUB, such as Adobe Digital Editions or FBReader – both free (see eBook Help).
- Tablet/Smartphone (Android; iOS): Install the free app Adobe Digital Editions or the app PocketBook (see eBook Help).
- E-reader: Bookeen, Kobo, Pocketbook, Sony, Tolino and many more (not Kindle).
The file format ePUB works well for novels and non-fiction books – i.e., 'flowing' text without complex layout. On an e-reader or smartphone, line and page breaks automatically adjust to fit the small displays.
This eBook does not use copy protection or Digital Rights Management
For more information, see our eBook Help page.