33
Introduction

Pengantar Ruby on Rails

Embed Size (px)

Citation preview

Introduction

Ashari Juang

Software Quality and Testing at Qisc.us

What Ruby is

a Dynamic, Open Source Programming language with focus on simplicity and productivity

Yukihiro Matsumoto @matz

Creator of Ruby Programing [1995] www.ruby-lang.org

Object Oriented

Everything in Ruby is Object

[ instance of Class ]

class Bahasa

def initialize(name, creator)

@name = name

@creator = creator

end

def deskripsi

puts "Bahasa pemrograman #{@name} diciptakan oleh #{@creator}!"

end

end

Why Ruby ?

Open Source

https://github.com/ruby/ruby

Readable and Beautiful

No Semicolons, Parenthesis, and method chaining.

RVM

Ruby Version Manager

Install, manage, work with multiple ruby environment

Ruby Libraries

RubyGems

Packageed ruby libraries or application

Installing Gems

www.rubygems.org

gem install [gem_name]

Bundler

Dependency Management

Rake

Command line tool to script common tasks.

Run migrate or test suit

What next ?

Gem install rails

Ruby on Rails

Fast and fun way to develop web app

David Heinemeire Hansson [DHH]

Creator of Ruby on Rails [2004]

What Rails is

https://github.com/rails/rails

Framework

A web application framework

Pattern

Model View Controller

Architectural pattern

Why Rails ?

Awesomeness

Model

In Ruby on Rails, the “default” way is one table for one model.

$> rails generate model Profile username:string age:integer

Controller

controller for one flow/feature of the app

$> rails generate controller Profile index

View

way is to have one html view for one method in Controller

You can generate view simply by create a new file in view folder

Big Name

http://netguru.co

ActiveRecord

ORM (Object Relation Mapping)

1 database table maps to 1 Ruby class

Testing

Rails was built with testing support

Default use mini test

Environment

Diferent env with same app

Development, testing, production

Comunity

Lots of resource to learn

http://rubyonrails.org/screencasts/

NOW Let’s do stuff

Referensi

•  www.ruby-lang.com

•  www.speakerdeck.com/eavgerinos/