Soon to be Ruby on Rails --API programmer
$7.99
Minimum price
$9.99
Suggested price

Soon to be Ruby on Rails --API programmer

Building API could be fund with Ruby on Rails. Let Rails help you with easy and fast coding while you only need to worry about requirements and features.

About the Book

Good News! The Thai version of this book is completed. I'm working on the English version now. Expecting it to be completed by April.

If you want to start building your new web application and you picked to completely separate Client side and Server side codes completely. Then it's a high chance that you need to build API regardless of what you picked for your frontend.

I've used Ruby on Rails in my software house since 2011 and personally think that it is more than enough for most of my customers.

Now that Ruby on Rails has this "--api" option where you only use Rails to build API. No HTML, CSS, JS rendered from backend (except for emails). I only use this "--api" option for newer projects and moved my frontend to use NuxtJS, NextJS or AngularJS.

My life is now much simpler because I can now separate task between frontend and backend. My team work more effectively, and even better unit test.

This book is to show you how to write API on Rails. It's purely based on code and building prototype application.

This book will not cover Unit Test, I think it's better to start with the fun part and continue with the boring part in the next book.

This book is a translation into English of เกิดอยากจะเขียน API ง่ายๆ ด้วย Ruby on Rails which was originally written in Thai.

About the Author

SaKKo Sama
SaKKo Sama

I'm a self taught programmer with over 10 years experience.

I joined Leanpub to share my knowledge and experience.

I started my own company, a software house, in the year 2010.

I coded lots of projects throughout those years trying out lots of stuffs like

ObjectiveC, Ruby on Rails, Nodejs, Swift, Java, Kotlin, Dart, Golang, ionic, react-native, Vue, React, ....

Deployed them on a bunch for infrastructures

Bare Metal, Government Cloud, VPS, Digital Ocean, AWS, Google Cloud Platform, and on some Serverless arch

Taught Internet Programming to 70+ students in University as part-time lecturer in Thailand.

Trained over 100+ people in iOS Basic and Advance courses ages ago when there were no Swift.

Taught high school math for a year, 36 hours a week.

My dream is to start a school where all students can do what the love. (and not hate Math)

Obviously, it takes a lot of money to start a school. If you can fund me a few million $ to start a school in Thailand, Please contact me.

I hope you enjoy my books.

Visit my youtube channel at https://youtube.com/sakkosama

Table of Contents

  • 1 Introduction
    • 1.1 A little intro about Ruby on Rails
  • 2 Setup your development environment
    • 2.1 RVM
    • 2.2 Ruby
    • 2.3 NVM (optional)
    • 2.4 NodeJS (optional)
    • 2.5 Ruby on Rails
    • 2.6 Text Editor
      • Atom
      • Sublime Text 3
      • VSCode
    • 2.7 Postman / Hoppscotch
  • 3 Creating Ruby on Rails Project
  • 4 Folder structure
    • 4.1 .ruby-version
    • 4.2 .ruby-gemset (new)
    • 4.3 Gemfile & Gemfile.lock
    • 4.4 config folder
    • 4.5 config/database.yml
    • 4.6 Environments files config/environments/*.rb
    • 4.7 app folder
    • 4.8 app/controllers/application_controller.rb
    • 4.9 app/models/application_record.rb
    • 4.10 Other folders and files
  • 5 Ruby
    • 5.1 Numbers
    • 5.2 BigDecimal (Rails only)
    • 5.3 Strings
    • 5.4 Comment
    • 5.5 Print
    • 5.6 Object Methods
    • 5.7 Array
    • 5.8 Hash
    • 5.9 Blocks
    • 5.10 Modify Built-in Class
  • 6 Controller for Beginner
    • 6.1 HTTP Request / Actions
    • 6.2 Static GET API
      • Cross origin request (rack-cors)
    • 6.3 POST PUT PATCH DELETE for Static
  • 7 Models and Migration
    • 7.1 Creating Model
    • 7.2 Migrating Database
  • 8 Rails Console
    • 8.1 Ruby
    • 8.2 The power of Rails console
    • 8.3 Rails powered by Ruby is fun
  • 9 CRUD ​API
    • 9.1 Review
    • 9.2 RESTful APIs
    • 9.3 API GET users
    • 9.4 API GET users/:id
    • 9.5 API POST /users create
    • 9.6 API PATCH /users/:id update
    • 9.7 API DELETE /users/:id destroy
    • 9.8 Resourceful routes
    • 9.9 Final words on CRUD API
  • 10 The Power of Scaffolding
    • 10.1 rails g scaffold
    • 10.2 Controller from scaffold
  • 11 Model Relationship
    • 11.1 ER Diagram
    • 11.2 Starting small project
    • 11.3 Scaffold APIs
    • 11.4 The Missing APIs
    • 11.5 Model’s Relationship
    • 11.6 Testing Model’s Relationship
    • 11.7 Add missing API
    • 11.8 Extra
  • 12 Sending Emails
    • 12.1 Action Mailer Basic
    • 12.2 HTML Email Template Layouts
    • 12.3 Test sending email

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.

You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!

So, there's no reason not to click the Add to Cart button, is there?

See full terms...

Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earnedover $14 millionwriting, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub