Slide 1

Slide 1 text

Rail to the Ruby and Rails world

Slide 2

Slide 2 text

:VTVLF.JUP $PPLQBE*OD -JWJOHJO"MJDBOUFTJODF.BZ Z !Z@

Slide 3

Slide 3 text

Cookpad http://info.mis-recetas.org/jobs/ Our mission Make everyday cooking fun We’re searching for No.1 engineer! Cookpad is A company which solves user’s issues by technology A company which solves issues of all the people in the world

Slide 4

Slide 4 text

Ruby

Slide 5

Slide 5 text

1995 v0.95 History of Ruby 2003 v1.8 2007 v1.9 2013 Feb. v2.0 2013 Dec. v2.1 2014 v2.2 Ruby is intensively developed over 20 years

Slide 6

Slide 6 text

$ cat hello.rb class Hello def initialize(name) @name = name end def say puts "Hello, #{@name}!" end end hello = Hello.new("David") hello.say $ ruby hello.rb #=> Hello, David! class declaration→ method declaration→ Instantiation→ Method call→ Basic Ruby Syntax instance variable→

Slide 7

Slide 7 text

3 Must-Know Tools for Ruby developing rbenv RubyGems bundler

Slide 8

Slide 8 text

rbenv # install ruby 2.1.5 $ rbenv install 2.1.5 $ rbenv shell 2.1.5 $ ruby -v ruby 2.1.5p273 (2014-11-13 revision 48405) [x86_64-linux] # install ruby 2.2.2 $ rbenv install 2.2.2 $ rbenv shell 2.2.2 $ ruby -v ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-linux] Simple Ruby Version Management Tool There are similar tools for other languages: plenv phpenv pyenv…

Slide 9

Slide 9 text

RubyGems is a standard package manager for the Ruby Anyone can make own gem and publish it to https://rubygems.org RubyGems # install gem $ gem install nokogiri $ irb > require ‘nokogiri’ > doc = Nokogiri::HTML.parse('
world
') > doc.search('.hello').text => "world" * irb is Interactive Ruby. REPL for Ruby. Similar to PEAR for PHP, CPAN for Perl, pip for Python, npm for Node.js etc

Slide 10

Slide 10 text

Managing the gems that the application depends on Bundler $ cat Gemfile source ‘https://rubygems.org' gem ‘nokogiri’ gem ‘rails’ $ bundle #=> Install all gems listed in Gemfile Bundler makes sure Ruby applications run the same code on every machine by installing given list of gems and its depending gems Similar to composer for PHP, carton for Perl, CocoaPods for iOS, etc

Slide 11

Slide 11 text

So, Let’s begin to talk about Rails

Slide 12

Slide 12 text

Ruby on Rails

Slide 13

Slide 13 text

Ruby on Rails is a web application framework based on MVC pattern

Slide 14

Slide 14 text

Rails builds up with multiple sub frameworks

Slide 15

Slide 15 text

Model - ActiveRecord - O/R Mapper View - ActionView - View Template Handler Controller - ActionPack - Request/Response Handler Most important frameworks

Slide 16

Slide 16 text

ActiveSupport - Utilities and Ruby Extensions ActiveJob - Asynchronous Job Queue ActionMailer - Email Delivering And other useful frameworks

Slide 17

Slide 17 text

Demo Making simple Rails application from scratch

Slide 18

Slide 18 text

Useful Gems

Slide 19

Slide 19 text

Haml is a template language that provides more simple and clean syntax for markup Haml

<%= post.title %>

<%= post.subtitle %>

<%= post.content %>
%section.container %h1= post.title %h2= post.subtitle .content = post.content

Slide 20

Slide 20 text

You can build a complex form with less code than default form builder Simple Form <%= form_for @user do |f| %>
<%= f.label :name %> <%= f.text_field :name %>
<%= f.label :email %> <%= f.text_field :email %>
<%= f.label :birthday %> <%= f.date_field :birthday %>
<%= f.submit %>
<% end %> <%= simple_form_for @user do |f| %> <%= f.input :name %> <%= f.input :email %> <%= f.input :birthday %> <%= f.button :submit %> <% end %>

Slide 21

Slide 21 text

Use Ruby REPL everywhere Web Console

Slide 22

Slide 22 text

carrierwave - Flexible Image Uploader kaminari - De facto paginator for Rails omniauth - Standardizes multi provider authentication redcarpet - Markdown parser and renderer Other useful gems

Slide 23

Slide 23 text

No content

Slide 24

Slide 24 text

Rails Guides - Official guide of rails http://guides.rubyonrails.org/ Rails Girls Guides - Rails guide for beginner programmer http://guides.railsgirls.com/ Rails Tutorial https://www.railstutorial.org/book Rails API References http://api.rubyonrails.org/ Good documents to learn Rails