Book Image

From PHP to Ruby on Rails

By : Bernard Pineda
4 (1)
Book Image

From PHP to Ruby on Rails

4 (1)
By: Bernard Pineda

Overview of this book

Are 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.
Table of Contents (15 chapters)
1
Part 1:From PHP to Ruby Basics
8
Part 2:Ruby and the Web

Understanding IRB’s usefulness

In Chapter 3, we briefly saw the IRB shell, and I hope you noticed some of the similarities between IRB and our debugging tools. Basically, what these gems do is enhance IRB so that we can view variables in memory, move around execution points, and work in a “frozen” state of our program. At the end of the day, you will be able to choose which one of these tools is more convenient for your everyday use. I could steer you toward one, or you could simply use the built-in IRB. One technique I saw a fellow developer use was that he wrote most of his code in IRB, and once the code ran without problems, he would just copy the code from IRB into an IDE to save his work. This saved him a lot of time that he would have otherwise used on testing. Another coworker used a very popular IDE called RubyMine. This tool allows us to add breaking points at the touch of a button (among many other features). Additionally, one downside of using debuggers...