Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Rails API
Search
Saurabh Bhatia
February 22, 2014
Technology
460
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Rails API
API only applications with Rails API
Saurabh Bhatia
February 22, 2014
More Decks by Saurabh Bhatia
See All by Saurabh Bhatia
Barrister RPC
thewub
0
470
RulingOrbit
thewub
0
390
Symbols and Hashes Intro
thewub
0
68
Cloud Primer
thewub
1
420
Other Decks in Technology
See All in Technology
幾何アルゴリズムで なめらかなピン操作を / iOSDC Japan 2026 / smoothpin
kazumanagano
0
340
[2026-09-11]SREは誰のもの?運用エンジニアが始める 「SRE領域への越境」とチームの進化の軌跡 〜Road to NEXT CRE
tosite
0
210
新機種発売前に見直そう!端末移行で再ログインが要るアプリ・要らないアプリは何が違うのか 〜シームレスに再開できる設計と実装〜
zozotech
PRO
0
170
作品が生態系になった ─ Mini Tokyo 3D から世界へ
nagix
0
180
Snowflakeのコスト最適化を支えるアーキテクチャ設計
ktatsuya
1
1.6k
フルカイテン株式会社 エンジニア向け採用資料
fullkaiten
0
12k
目の前の楽しいが人生を変える - コミュニティの螺旋の歩き方と楽しむコツ / change your life
soudai
PRO
4
560
DEFCON_CHV_CTF_Write-up.pdf
bata_24
0
150
「守り」で活用するオンデバイスLLM 〜写ってはいけないを総力戦で防ぐ〜 / iOSDC Japan 2026
nakamuuu
0
150
LTのテーマ どうきめてる?〜5つの型と私のやり方〜
yama3133
1
100
すぐできる衛星通信対応 あとは山奥に行くだけ
tatetate55
0
120
range over func 2年間の軌跡 Issue #56413 はGoのエコシステムをどう変えたか
ryujicre8ive
0
170
Featured
See All Featured
brightonSEO & MeasureFest 2025 - Christian Goodrich - Winning strategies for Black Friday CRO & PPC
cargoodrich
3
840
HDC tutorial
michielstock
2
870
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.5k
sira's awesome portfolio website redesign presentation
elsirapls
0
410
Agile that works and the tools we love
rasmusluckow
331
22k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
2.2k
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
350
Between Models and Reality
mayunak
4
450
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
240
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.6k
Why You Should Never Use an ORM
jnunemaker
PRO
61
10k
Transcript
API Only Applications with rails-api Saurabh Bhatia http://fedible.org
what? $ gem install rails-api Rails minus some middleware stack,
actionpack modules and template generation.
why? • Lightweight • Fast • API only application –
backend for mobile app, web application is just another client (e.g. html, angular.js ) to a json api.
Generating a new app $ rails-api new notesapp
No views
rails-api controller app/controllers/application_controller.rb class ApplicationController < ActionController::API end
controller actions def index @posts = Post.all render json: @posts
end • rails-api uses render instead of respond methods. • Let's see how to include those.
extending controller class ApplicationController < ActionController::API include ActionController::MimeResponds include ActionController::ImplicitRender
end • MimeResponds and Implicit render provide support for respond_to, respond_with.
middleware
extending middleware $config/application.rb require File.expand_path('../boot', __FILE__) require 'rails/all'. Bundler.require(:default, Rails.env)
module Notesapp class Application < Rails::Application config.middleware.use ActionDispatch::Flash end end
extended
serializers • gem "active_model_serializers" • $rails g serialzer post •
$ ls assets controllers mailers models serializers app$ cd serializers/ app/serializers$ ls post_serializer.rb
serialzers class PostSerializer < ActiveModel::Serializer attributes :title, :body end •
JSON Response {"posts": [{"id":1,"title":"First Post","body":"Test"}, {"id":2,"title":"Second Post","body":"Another Test"}] }
Shameless Plug : Rails 4 application development
Thank you 謝謝