SlideShare a Scribd company logo
1 of 52
Download to read offline
Introduction to Ruby on Rails
Presented by: Arman Ortega
rubyonrails.org
What you'll learn
➔ Overview of Ruby
➔ Overview of Rails
➔ Convention over Configuration
➔ CRUD – Create, Read, Update & Delete
➔ Sample Rails app (Blog)
➔ Short Activity (railszombies.org)
Ruby is object oriented
 Everything is an object. Integers, Floats, Booleans, Strings, Arrays, Hash – all are objects.
 Ruby is simple, elegant & natural syntax
 Inspired by Perl, Python, LISP
 Less lines of code, higher productivity
In PHP:
function say_hi($name)
{
$out = "Hi $name ";
return $out;
}
say_hi("Michelle");
In Ruby:
def say_hi name
out = "Hi #{name} "
out
end
say_hi "Michelle"
Interactive Ruby (irb)
irb(main):001:0> s = "Hello World"
=> "Hello World"
irb(main):002:0> s.length
=> 11
irb(main):003:0> s.upcase
=> "HELLO WORLD"
irb(main):004:0> s.downcase
=> "hello world"
irb(main):005:0> s.downcase.reverse
=> "dlrow olleh"
irb(main):006:0> n = 2 + 3
=> 5
irb(main):007:0> n.class
=> Fixnum
irb(main):008:0> 5.times { print s }
Hello WorldHello WorldHello WorldHello
WorldHello World
C:Ruby193bin>irb
Provides a shell(command
prompt) for experimentation.
String method
String class
Fixnum class
Arrays - are ordered, integer-indexed collections of any
object. Indexing starts at 0, as in C or Java.
e.g. pet = Array.new or []
irb> pet = ["dog", "cat", "mouse"]
irb> pet.count
=> 3
irb> pet.index("cat")
=> 1
irb> pet[2]
=> "mouse"
Hashes - is a collection of key-value pairs.
e.g. style = Hash.new or {}
irb> style = { "font_size" => 10, "font_family" => "Arial" }
=> {"font_size"=>10, "font_family"=>"Arial"}
irb> style["font_size"]
=> 10
Arrays & Hashes
More about Ruby
http://tryruby.org – an interactive tutorial
https://www.ruby-lang.org/en/documentation
What is Rails?
 Rails is an open-source web framework that’s optimized for programmer
happiness and sustainable productivity.
 Less lines of code, higher productivity.
 It is an MVC web framework where Models, Views and Controllers are fully
integrated.
 Written in Ruby language.
http://rubyonrails.org/ https://www.ruby-lang.org/en/
Overview of Rails
 Convention over Configuration
 ActiveRecord
– is the M in MVC – the model.
– It is the Object/Relational Mapping (ORM) layer supplied with Rails.
It closely follows the standard ORM model such as:
* tables map to classes
* columns map to object attributes
* rows map to objects
id title body
1 hello world
Table: articles
a = Article.new
Object attribute
a.title
Convention over Configuration
Database Table - Plural with underscores separating words (e.g. articles, asset_images )
Model Class - Singular with the first letter of each word capitalized (e.g. Article, AssetImage)
Filenames are written in lowercase, with underscores separating each word.
id int(11)
title varchar(255)
body text
created_at datetime
updated_at datetime
Table: articles
class Article < ActiveRecord::Base
. . .
end
File: models/article.rb
Class name Filename
UserController user_controller.rb
StatusMessagesController status_messages_controller.rb
RemoteUploader remote_uploader.rb
Another example:
Example:
CRUD: Create, Read, Update &
Delete
Create
example:
a = Article.new
a.title = "hello"
a.body = "world"
a.save
Read
ModelClass.find(id)
example:
Article.find(1)
ModelClass.where()
example:
Article.where("title = ?", "MH17")
m = ModelClass.new
m.attribute = value
m.save
syntax:
More details: http://guides.rubyonrails.org/active_record_basics.html
CRUD: Create, Read, Update &
Delete
Update
m = ModelClass.find_by(field: value)
m.attribute = value
m.save
example:
a = Article.find_by(id: 1)
a.title = "hello"
a.body = "world"
a.save
Delete
a = ModelClass.find_by(field: value)
a.destroy
example:
a = Article.find_by(title:"hi")
a.destroy
m = ModelClass.find_by(field1:value,
field2: value)
m.update(field1: value1,
field2: value2)
m = Article.find_by(title: "lorem1",
body: "lorem1")
m.update(title: "lorem2",
body: "lorem2")
Alternative way
Installing Rails
For Windows
 Rails Installer 2.2.3 (http://railsinstaller.org/en)
Packages included are:
Ruby
Rails
Bundler -manage your gem dependencies
Git
. . .
 XAMPP 1.8.2 (https://www.apachefriends.org/download.html)
Packages included are:
Apache 2
MySQL 5.6
PHP 5
phpMyAdmin
. . .
For Linux, see the links below on how to install Rails on Linux
http://coding.smashingmagazine.com/2011/06/21/set-up-an-ubuntu-local-development-machine-for-ruby-on-rails/
http://www.computersnyou.com/1535/2013/03/installing-ruby-on-rail-on-ubuntu-with-rbenv-step-by-step/
https://help.ubuntu.com/community/RubyOnRails
Step 1 of 3 Step 2 of 3
Step 3 of 3
How to verify the load path in Ruby?
> ruby -e 'puts $:'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1
C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/i386-msvcrt
C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby
C:/RailsInstaller/Ruby1.9.3/lib/ruby/vendor_ruby/1.9.1
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/i386-mingw32
Installing Rails Installer on Windows
Installing XAMPP on Windows
Some common errors during setup
Problem:
Error installing mysql2: ERROR: Failed to build gem native extension.
Solution:
> gem install mysql2 -- '--with-mysql-lib="C:xamppmysqllib" --with-
mysql-include="C:xamppmysqlinclude"'
Problem:
Incorrect MySQL client library version! This gem was compiled for
5.6.16 but the client library is 5.5.27. (RuntimeError)
Solution:
You need to copy libmysql.dll from MySQL installation directory(e.g.
c:>xamppmysqllib) and paste it to
C:RailsInstaller2.2.3Ruby1.9.3bin
Sample Rails app (blog)
> rails new APP_NAME --database=mysql
e.g. rails new blog --database=mysql
create
create README.rdoc
create Rakefile
create config.ru
create .gitignore
create Gemfile
create app
create app/assets/javascripts/application.js
create app/assets/stylesheets/application.css
create app/controllers/application_controller.rb
create app/helpers/application_helper.rb
create app/views/layouts/application.html.erb
. . .
run bundle install
Fetching gem metadata from https://rubygems.org/...........
Fetching additional metadata from https://rubygems.org/..
Resolving dependencies...
Using rake 10.3.2
Using i18n 0.6.11
Using activerecord 4.1.4
Using bundler 1.6.2
. . .
Your bundle is complete!
Rails directory structure
+-app
| +-assets
| | +-images
| | +-javascripts
| | +-stylesheets
| +-controllers
| +-helpers
| +-mailers
| +-models
| +-views
+-config (database.yml, routes.rb, application.rb, etc)
+-db (migration files)
+-lib
+-log (log files used for debugging)
+-public (404.html, favicon.ico, robots.txt)
+-test
+-vendor (third-party javascripts/css like twitter-bootstrap or jquery )
+-images
+-javascripts
+-stylesheets
Gemfile
README.rdoc
config/database.yml
development:
adapter: mysql2
database: blog_dev
username: root
password:
host: localhost
test:
adapter: mysql2
database: blog_test
username: root
password:
host: localhost
production:
adapter: mysql2
database: blog_prod
username: root
password:
host: localhost
After configuring the database.yml. Then, let's create all databases
> rake db:create:all
Rake is used for common administration tasks.
Sample rake commands are:
> rake db:migrate RAILS_ENV=development
> rake db:create:all
> rake routes
To run the app
C:railsappAPP_NAME> rails s
config/routes.rb
Rails.application.routes.draw do
get 'articles/add', to: 'articles#add', as: 'articles_add'
get 'articles/:id', to: 'articles#details', as: 'articles_details'
get 'articles/:id/edit', to: 'articles#edit', as: 'articles_edit'
get 'articles/:id/delete', to: 'articles#delete', as: 'articles_delete'
post 'articles/save', to: 'articles#save', as: 'articles_save'
post 'articles/update', to: 'articles#update', as: 'articles_update'
get 'welcome/index', to: 'welcome#index', as: 'welcome_index'
root 'welcome#index'
end
Router
In controller:
def details
@article = Article.find params[:id]
end
The Rails router recognizes URLs and dispatches
them to a controller's action.
GET articles/1
In routes.rb
get '/articles/:id', to: 'articles#details', as: 'articles_details'
get 'welcome/index', to: 'welcome#index', as: 'welcome_index'
. . .
In views:
<div class="article">
<em><%= time_ago_in_words(@article.updated_at) %> ago</em>
<h3><%= @article.title %></h3>
<p><%= @article.body %></p>
<%= link_to "<<Back to Home", welcome_index_path %>
</div>
Running the app
'rails server' or 'rails s' command
> rails s
=> BootingWEBrick
=> Rails 4.1.4 application starting in development
on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Notice: server is listening on all interfaces
(0.0.0.0). Consider using 127.0.0.1 (--binding
option)
=> Ctrl-C to shutdown server
Creating a Controller
'rails generate' or 'rails g' command
rails generate controller <NAME> <action1> <action2> . . .
e.g. > rails generate controller Welcome index
create app/controllers/welcome_controller.rb
route get 'welcome/index‘
invoke erb
create app/views/welcome
create app/views/welcome/index.html.erb
. . .
> rails generate controller Articles add save edit update
create app/controllers/articles_controller.rb
route get 'articles/update'
route get 'articles/edit'
route get 'articles/add'
invoke erb
create app/views/articles
create app/views/articles/add.html.erb
create app/views/articles/edit.html.erb
create app/views/articles/delete.html.erb
. . .
More info: http://guides.rubyonrails.org/command_line.html#rails-generate
Creating a Model
rails generate model <MODEL_NAME> <field1:type> <field2:type> . . .
e.g.
> rails generate model Article title:string body:text
invoke active_record
create db/migrate/20140705184622_create_articles.rb
create app/models/article.rb
. . .
. . .
File: db/migrate/20140705184622_create_articles.rb
File: app/models/article.rb
Creating a views
File: views/articles/add.html.erb
More info: http://guides.rubyonrails.org/form_helpers.html
Useful links
 https://www.ruby-lang.org/en/documentation/
 http://guides.rubyonrails.org/getting_started.html
 http://tryruby.org
 http://railsforzombies.org
Thank you!
8/8/14 1
Introduction to Ruby on Rails
Presented by: Arman Ortega
rubyonrails.org
8/8/14 2
What you'll learn
➔ Overview of Ruby
➔ Overview of Rails
➔ Convention over Configuration
➔ CRUD – Create, Read, Update & Delete
➔ Sample Rails app (Blog)
➔ Short Activity (railszombies.org)
8/8/14 3
Ruby is object oriented
 Everything is an object. Integers, Floats, Booleans, Strings, Arrays, Hash – all are objects.
 Ruby is simple, elegant & natural syntax
 Inspired by Perl, Python, LISP
 Less lines of code, higher productivity
In PHP:
function say_hi($name)
{
$out = "Hi $name ";
return $out;
}
say_hi("Michelle");
In Ruby:
def say_hi name
out = "Hi #{name} "
out
end
say_hi "Michelle"
8/8/14 4
Interactive Ruby (irb)
irb(main):001:0> s = "Hello World"
=> "Hello World"
irb(main):002:0> s.length
=> 11
irb(main):003:0> s.upcase
=> "HELLO WORLD"
irb(main):004:0> s.downcase
=> "hello world"
irb(main):005:0> s.downcase.reverse
=> "dlrow olleh"
irb(main):006:0> n = 2 + 3
=> 5
irb(main):007:0> n.class
=> Fixnum
irb(main):008:0> 5.times { print s }
Hello WorldHello WorldHello WorldHello
WorldHello World
C:Ruby193bin>irb
Provides a shell(command
prompt) for experimentation.
String method
String class
Fixnum class
8/8/14 5
Arrays - are ordered, integer-indexed collections of any
object. Indexing starts at 0, as in C or Java.
e.g. pet = Array.new or []
irb> pet = ["dog", "cat", "mouse"]
irb> pet.count
=> 3
irb> pet.index("cat")
=> 1
irb> pet[2]
=> "mouse"
Hashes - is a collection of key-value pairs.
e.g. style = Hash.new or {}
irb> style = { "font_size" => 10, "font_family" => "Arial" }
=> {"font_size"=>10, "font_family"=>"Arial"}
irb> style["font_size"]
=> 10
Arrays & Hashes
8/8/14 6
More about Ruby
http://tryruby.org – an interactive tutorial
https://www.ruby-lang.org/en/documentation
8/8/14 7
What is Rails?
 Rails is an open-source web framework that’s optimized for programmer
happiness and sustainable productivity.
 Less lines of code, higher productivity.
 It is an MVC web framework where Models, Views and Controllers are fully
integrated.
 Written in Ruby language.
http://rubyonrails.org/ https://www.ruby-lang.org/en/
8/8/14 8
Overview of Rails
 Convention over Configuration
 ActiveRecord
– is the M in MVC – the model.
– It is the Object/Relational Mapping (ORM) layer supplied with Rails.
It closely follows the standard ORM model such as:
* tables map to classes
* columns map to object attributes
* rows map to objects
id title body
1 hello world
Table: articles
a = Article.new
Object attribute
a.title
8/8/14 9
Convention over Configuration
Database Table - Plural with underscores separating words (e.g. articles, asset_images )
Model Class - Singular with the first letter of each word capitalized (e.g. Article, AssetImage)
Filenames are written in lowercase, with underscores separating each word.
id int(11)
title varchar(255)
body text
created_at datetime
updated_at datetime
Table: articles
class Article < ActiveRecord::Base
. . .
end
File: models/article.rb
Class name Filename
UserController user_controller.rb
StatusMessagesController status_messages_controller.rb
RemoteUploader remote_uploader.rb
Another example:
Example:
8/8/14 10
CRUD: Create, Read, Update &
Delete
Create
example:
a = Article.new
a.title = "hello"
a.body = "world"
a.save
Read
ModelClass.find(id)
example:
Article.find(1)
ModelClass.where()
example:
Article.where("title = ?", "MH17")
m = ModelClass.new
m.attribute = value
m.save
syntax:
More details: http://guides.rubyonrails.org/active_record_basics.html
8/8/14 11
CRUD: Create, Read, Update &
Delete
Update
m = ModelClass.find_by(field: value)
m.attribute = value
m.save
example:
a = Article.find_by(id: 1)
a.title = "hello"
a.body = "world"
a.save
Delete
a = ModelClass.find_by(field: value)
a.destroy
example:
a = Article.find_by(title:"hi")
a.destroy
m = ModelClass.find_by(field1:value,
field2: value)
m.update(field1: value1,
field2: value2)
m = Article.find_by(title: "lorem1",
body: "lorem1")
m.update(title: "lorem2",
body: "lorem2")
Alternative way
8/8/14 12
Installing Rails
For Windows
 Rails Installer 2.2.3 (http://railsinstaller.org/en)
Packages included are:
Ruby
Rails
Bundler -manage your gem dependencies
Git
. . .
 XAMPP 1.8.2 (https://www.apachefriends.org/download.html)
Packages included are:
Apache 2
MySQL 5.6
PHP 5
phpMyAdmin
. . .
For Linux, see the links below on how to install Rails on Linux
http://coding.smashingmagazine.com/2011/06/21/set-up-an-ubuntu-local-development-machine-for-ruby-on-rails/
http://www.computersnyou.com/1535/2013/03/installing-ruby-on-rail-on-ubuntu-with-rbenv-step-by-step/
https://help.ubuntu.com/community/RubyOnRails
8/8/14 13
Step 1 of 3 Step 2 of 3
Step 3 of 3
How to verify the load path in Ruby?
> ruby -e 'puts $:'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1
C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/i386-msvcrt
C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby
C:/RailsInstaller/Ruby1.9.3/lib/ruby/vendor_ruby/1.9.1
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/i386-mingw32
Installing Rails Installer on Windows
8/8/14 14
Installing XAMPP on Windows
8/8/14 15
Some common errors during setup
Problem:
Error installing mysql2: ERROR: Failed to build gem native extension.
Solution:
> gem install mysql2 -- '--with-mysql-lib="C:xamppmysqllib" --with-
mysql-include="C:xamppmysqlinclude"'
Problem:
Incorrect MySQL client library version! This gem was compiled for
5.6.16 but the client library is 5.5.27. (RuntimeError)
Solution:
You need to copy libmysql.dll from MySQL installation directory(e.g.
c:>xamppmysqllib) and paste it to
C:RailsInstaller2.2.3Ruby1.9.3bin
8/8/14 16
Sample Rails app (blog)
> rails new APP_NAME --database=mysql
e.g. rails new blog --database=mysql
create
create README.rdoc
create Rakefile
create config.ru
create .gitignore
create Gemfile
create app
create app/assets/javascripts/application.js
create app/assets/stylesheets/application.css
create app/controllers/application_controller.rb
create app/helpers/application_helper.rb
create app/views/layouts/application.html.erb
. . .
run bundle install
Fetching gem metadata from https://rubygems.org/...........
Fetching additional metadata from https://rubygems.org/..
Resolving dependencies...
Using rake 10.3.2
Using i18n 0.6.11
Using activerecord 4.1.4
Using bundler 1.6.2
. . .
Your bundle is complete!
8/8/14 17
Rails directory structure
+-app
| +-assets
| | +-images
| | +-javascripts
| | +-stylesheets
| +-controllers
| +-helpers
| +-mailers
| +-models
| +-views
+-config (database.yml, routes.rb, application.rb, etc)
+-db (migration files)
+-lib
+-log (log files used for debugging)
+-public (404.html, favicon.ico, robots.txt)
+-test
+-vendor (third-party javascripts/css like twitter-bootstrap or jquery )
+-images
+-javascripts
+-stylesheets
Gemfile
README.rdoc
8/8/14 18
config/database.yml
development:
adapter: mysql2
database: blog_dev
username: root
password:
host: localhost
test:
adapter: mysql2
database: blog_test
username: root
password:
host: localhost
production:
adapter: mysql2
database: blog_prod
username: root
password:
host: localhost
After configuring the database.yml. Then, let's create all databases
> rake db:create:all
Rake is used for common administration tasks.
Sample rake commands are:
> rake db:migrate RAILS_ENV=development
> rake db:create:all
> rake routes
To run the app
C:railsappAPP_NAME> rails s
8/8/14 19
config/routes.rb
Rails.application.routes.draw do
get 'articles/add', to: 'articles#add', as: 'articles_add'
get 'articles/:id', to: 'articles#details', as: 'articles_details'
get 'articles/:id/edit', to: 'articles#edit', as: 'articles_edit'
get 'articles/:id/delete', to: 'articles#delete', as: 'articles_delete'
post 'articles/save', to: 'articles#save', as: 'articles_save'
post 'articles/update', to: 'articles#update', as: 'articles_update'
get 'welcome/index', to: 'welcome#index', as: 'welcome_index'
root 'welcome#index'
end
8/8/14 20
Router
In controller:
def details
@article = Article.find params[:id]
end
The Rails router recognizes URLs and dispatches
them to a controller's action.
GET articles/1
In routes.rb
get '/articles/:id', to: 'articles#details', as: 'articles_details'
get 'welcome/index', to: 'welcome#index', as: 'welcome_index'
. . .
In views:
<div class="article">
<em><%= time_ago_in_words(@article.updated_at) %> ago</em>
<h3><%= @article.title %></h3>
<p><%= @article.body %></p>
<%= link_to "<<Back to Home", welcome_index_path %>
</div>
8/8/14 21
Running the app
'rails server' or 'rails s' command
> rails s
=> BootingWEBrick
=> Rails 4.1.4 application starting in development
on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Notice: server is listening on all interfaces
(0.0.0.0). Consider using 127.0.0.1 (--binding
option)
=>Ctrl-C to shutdown server
8/8/14 22
Creating a Controller
'rails generate' or 'rails g' command
rails generate controller <NAME> <action1> <action2> . . .
e.g. > rails generate controller Welcome index
create app/controllers/welcome_controller.rb
route get 'welcome/index‘
invoke erb
create app/views/welcome
create app/views/welcome/index.html.erb
. . .
> rails generate controller Articles add save edit update
create app/controllers/articles_controller.rb
route get 'articles/update'
route get 'articles/edit'
route get 'articles/add'
invoke erb
create app/views/articles
create app/views/articles/add.html.erb
create app/views/articles/edit.html.erb
create app/views/articles/delete.html.erb
. . .
More info: http://guides.rubyonrails.org/command_line.html#rails-generate
8/8/14 23
Creating a Model
rails generate model <MODEL_NAME> <field1:type> <field2:type> . . .
e.g.
> rails generate model Article title:string body:text
invoke active_record
create db/migrate/20140705184622_create_articles.rb
create app/models/article.rb
. . .
. . .
File: db/migrate/20140705184622_create_articles.rb
File: app/models/article.rb
8/8/14 24
Creating a views
File: views/articles/add.html.erb
More info: http://guides.rubyonrails.org/form_helpers.html
8/8/14 25
Useful links
 https://www.ruby-lang.org/en/documentation/
 http://guides.rubyonrails.org/getting_started.html
 http://tryruby.org
 http://railsforzombies.org
8/8/14 26
Thank you!

More Related Content

What's hot

Lightweight Webservices with Sinatra and RestClient
Lightweight Webservices with Sinatra and RestClientLightweight Webservices with Sinatra and RestClient
Lightweight Webservices with Sinatra and RestClientAdam Wiggins
 
Ruby on Rails Training - Module 1
Ruby on Rails Training - Module 1Ruby on Rails Training - Module 1
Ruby on Rails Training - Module 1Mark Menard
 
Keeping it Small: Getting to know the Slim Micro Framework
Keeping it Small: Getting to know the Slim Micro FrameworkKeeping it Small: Getting to know the Slim Micro Framework
Keeping it Small: Getting to know the Slim Micro FrameworkJeremy Kendall
 
Ror Seminar With agilebd.org on 23 Jan09
Ror Seminar With agilebd.org on 23 Jan09Ror Seminar With agilebd.org on 23 Jan09
Ror Seminar With agilebd.org on 23 Jan09Shaer Hassan
 
Bullet: The Functional PHP Micro-Framework
Bullet: The Functional PHP Micro-FrameworkBullet: The Functional PHP Micro-Framework
Bullet: The Functional PHP Micro-FrameworkVance Lucas
 
Introduction to Ruby on Rails
Introduction to Ruby on RailsIntroduction to Ruby on Rails
Introduction to Ruby on RailsAgnieszka Figiel
 
Ruby On Rails Basics
Ruby On Rails BasicsRuby On Rails Basics
Ruby On Rails BasicsAmit Solanki
 
Sinatra Rack And Middleware
Sinatra Rack And MiddlewareSinatra Rack And Middleware
Sinatra Rack And MiddlewareBen Schwarz
 
Introduction to Ruby on Rails
Introduction to Ruby on RailsIntroduction to Ruby on Rails
Introduction to Ruby on RailsManoj Kumar
 
Keeping it small - Getting to know the Slim PHP micro framework
Keeping it small - Getting to know the Slim PHP micro frameworkKeeping it small - Getting to know the Slim PHP micro framework
Keeping it small - Getting to know the Slim PHP micro frameworkJeremy Kendall
 
Intro to Rails
Intro to Rails Intro to Rails
Intro to Rails epiineg1
 
When To Use Ruby On Rails
When To Use Ruby On RailsWhen To Use Ruby On Rails
When To Use Ruby On Railsdosire
 
Creating REST Applications with the Slim Micro-Framework by Vikram Vaswani
Creating REST Applications with the Slim Micro-Framework by Vikram VaswaniCreating REST Applications with the Slim Micro-Framework by Vikram Vaswani
Creating REST Applications with the Slim Micro-Framework by Vikram Vaswanivvaswani
 
Slim RedBeanPHP and Knockout
Slim RedBeanPHP and KnockoutSlim RedBeanPHP and Knockout
Slim RedBeanPHP and KnockoutVic Metcalfe
 
Rails web api 开发
Rails web api 开发Rails web api 开发
Rails web api 开发shaokun
 
CouchDB: A NoSQL database
CouchDB: A NoSQL databaseCouchDB: A NoSQL database
CouchDB: A NoSQL databaseRubyc Slides
 
More to RoC weibo
More to RoC weiboMore to RoC weibo
More to RoC weiboshaokun
 
Ruby on Rails Presentation
Ruby on Rails PresentationRuby on Rails Presentation
Ruby on Rails PresentationJoost Hietbrink
 

What's hot (20)

Lightweight Webservices with Sinatra and RestClient
Lightweight Webservices with Sinatra and RestClientLightweight Webservices with Sinatra and RestClient
Lightweight Webservices with Sinatra and RestClient
 
Ruby on Rails Training - Module 1
Ruby on Rails Training - Module 1Ruby on Rails Training - Module 1
Ruby on Rails Training - Module 1
 
Keeping it Small: Getting to know the Slim Micro Framework
Keeping it Small: Getting to know the Slim Micro FrameworkKeeping it Small: Getting to know the Slim Micro Framework
Keeping it Small: Getting to know the Slim Micro Framework
 
Sinatra for REST services
Sinatra for REST servicesSinatra for REST services
Sinatra for REST services
 
Ror Seminar With agilebd.org on 23 Jan09
Ror Seminar With agilebd.org on 23 Jan09Ror Seminar With agilebd.org on 23 Jan09
Ror Seminar With agilebd.org on 23 Jan09
 
Bullet: The Functional PHP Micro-Framework
Bullet: The Functional PHP Micro-FrameworkBullet: The Functional PHP Micro-Framework
Bullet: The Functional PHP Micro-Framework
 
Introduction to Ruby on Rails
Introduction to Ruby on RailsIntroduction to Ruby on Rails
Introduction to Ruby on Rails
 
Ruby On Rails Basics
Ruby On Rails BasicsRuby On Rails Basics
Ruby On Rails Basics
 
Sinatra Rack And Middleware
Sinatra Rack And MiddlewareSinatra Rack And Middleware
Sinatra Rack And Middleware
 
Ruby on Rails Presentation
Ruby on Rails PresentationRuby on Rails Presentation
Ruby on Rails Presentation
 
Introduction to Ruby on Rails
Introduction to Ruby on RailsIntroduction to Ruby on Rails
Introduction to Ruby on Rails
 
Keeping it small - Getting to know the Slim PHP micro framework
Keeping it small - Getting to know the Slim PHP micro frameworkKeeping it small - Getting to know the Slim PHP micro framework
Keeping it small - Getting to know the Slim PHP micro framework
 
Intro to Rails
Intro to Rails Intro to Rails
Intro to Rails
 
When To Use Ruby On Rails
When To Use Ruby On RailsWhen To Use Ruby On Rails
When To Use Ruby On Rails
 
Creating REST Applications with the Slim Micro-Framework by Vikram Vaswani
Creating REST Applications with the Slim Micro-Framework by Vikram VaswaniCreating REST Applications with the Slim Micro-Framework by Vikram Vaswani
Creating REST Applications with the Slim Micro-Framework by Vikram Vaswani
 
Slim RedBeanPHP and Knockout
Slim RedBeanPHP and KnockoutSlim RedBeanPHP and Knockout
Slim RedBeanPHP and Knockout
 
Rails web api 开发
Rails web api 开发Rails web api 开发
Rails web api 开发
 
CouchDB: A NoSQL database
CouchDB: A NoSQL databaseCouchDB: A NoSQL database
CouchDB: A NoSQL database
 
More to RoC weibo
More to RoC weiboMore to RoC weibo
More to RoC weibo
 
Ruby on Rails Presentation
Ruby on Rails PresentationRuby on Rails Presentation
Ruby on Rails Presentation
 

Similar to Introduction to Rails - presented by Arman Ortega

Building web framework with Rack
Building web framework with RackBuilding web framework with Rack
Building web framework with Racksickill
 
What's new and great in Rails 3 - Matt Gauger - Milwaukee Ruby Users Group De...
What's new and great in Rails 3 - Matt Gauger - Milwaukee Ruby Users Group De...What's new and great in Rails 3 - Matt Gauger - Milwaukee Ruby Users Group De...
What's new and great in Rails 3 - Matt Gauger - Milwaukee Ruby Users Group De...Matt Gauger
 
Ruby on Rails
Ruby on RailsRuby on Rails
Ruby on RailsDelphiCon
 
Ruby on Rails survival guide of an aged Java developer
Ruby on Rails survival guide of an aged Java developerRuby on Rails survival guide of an aged Java developer
Ruby on Rails survival guide of an aged Java developergicappa
 
Connecting the Worlds of Java and Ruby with JRuby
Connecting the Worlds of Java and Ruby with JRubyConnecting the Worlds of Java and Ruby with JRuby
Connecting the Worlds of Java and Ruby with JRubyNick Sieger
 
Ruby on Rails - Introduction
Ruby on Rails - IntroductionRuby on Rails - Introduction
Ruby on Rails - IntroductionVagmi Mudumbai
 
Jasig Rubyon Rails
Jasig Rubyon RailsJasig Rubyon Rails
Jasig Rubyon RailsPaul Pajo
 
Learning to code for startup mvp session 3
Learning to code for startup mvp session 3Learning to code for startup mvp session 3
Learning to code for startup mvp session 3Henry S
 
Pourquoi ruby et rails déchirent
Pourquoi ruby et rails déchirentPourquoi ruby et rails déchirent
Pourquoi ruby et rails déchirentNicolas Ledez
 
Ruby C extensions at the Ruby drink-up of Sophia, April 2012
Ruby C extensions at the Ruby drink-up of Sophia, April 2012Ruby C extensions at the Ruby drink-up of Sophia, April 2012
Ruby C extensions at the Ruby drink-up of Sophia, April 2012rivierarb
 
20120121 rbc rails_routing
20120121 rbc rails_routing20120121 rbc rails_routing
20120121 rbc rails_routingTakeshi AKIMA
 
RoR 101: Session 2
RoR 101: Session 2RoR 101: Session 2
RoR 101: Session 2Rory Gianni
 
Ruby On Rails Tutorial
Ruby On Rails TutorialRuby On Rails Tutorial
Ruby On Rails Tutorialsunniboy
 
JRuby + Rails = Awesome Java Web Framework at Jfokus 2011
JRuby + Rails = Awesome Java Web Framework at Jfokus 2011JRuby + Rails = Awesome Java Web Framework at Jfokus 2011
JRuby + Rails = Awesome Java Web Framework at Jfokus 2011Nick Sieger
 
Intro to Rails and MVC
Intro to Rails and MVCIntro to Rails and MVC
Intro to Rails and MVCSarah Allen
 
Introduction To Ruby On Rails
Introduction To Ruby On RailsIntroduction To Ruby On Rails
Introduction To Ruby On RailsSteve Keener
 

Similar to Introduction to Rails - presented by Arman Ortega (20)

Intro to Rack
Intro to RackIntro to Rack
Intro to Rack
 
Building web framework with Rack
Building web framework with RackBuilding web framework with Rack
Building web framework with Rack
 
What's new and great in Rails 3 - Matt Gauger - Milwaukee Ruby Users Group De...
What's new and great in Rails 3 - Matt Gauger - Milwaukee Ruby Users Group De...What's new and great in Rails 3 - Matt Gauger - Milwaukee Ruby Users Group De...
What's new and great in Rails 3 - Matt Gauger - Milwaukee Ruby Users Group De...
 
Ruby on Rails
Ruby on RailsRuby on Rails
Ruby on Rails
 
Ruby on Rails survival guide of an aged Java developer
Ruby on Rails survival guide of an aged Java developerRuby on Rails survival guide of an aged Java developer
Ruby on Rails survival guide of an aged Java developer
 
Connecting the Worlds of Java and Ruby with JRuby
Connecting the Worlds of Java and Ruby with JRubyConnecting the Worlds of Java and Ruby with JRuby
Connecting the Worlds of Java and Ruby with JRuby
 
Ruby on Rails - Introduction
Ruby on Rails - IntroductionRuby on Rails - Introduction
Ruby on Rails - Introduction
 
Jasig Rubyon Rails
Jasig Rubyon RailsJasig Rubyon Rails
Jasig Rubyon Rails
 
Dev streams2
Dev streams2Dev streams2
Dev streams2
 
Ruby On Rails
Ruby On RailsRuby On Rails
Ruby On Rails
 
Rail3 intro 29th_sep_surendran
Rail3 intro 29th_sep_surendranRail3 intro 29th_sep_surendran
Rail3 intro 29th_sep_surendran
 
Learning to code for startup mvp session 3
Learning to code for startup mvp session 3Learning to code for startup mvp session 3
Learning to code for startup mvp session 3
 
Pourquoi ruby et rails déchirent
Pourquoi ruby et rails déchirentPourquoi ruby et rails déchirent
Pourquoi ruby et rails déchirent
 
Ruby C extensions at the Ruby drink-up of Sophia, April 2012
Ruby C extensions at the Ruby drink-up of Sophia, April 2012Ruby C extensions at the Ruby drink-up of Sophia, April 2012
Ruby C extensions at the Ruby drink-up of Sophia, April 2012
 
20120121 rbc rails_routing
20120121 rbc rails_routing20120121 rbc rails_routing
20120121 rbc rails_routing
 
RoR 101: Session 2
RoR 101: Session 2RoR 101: Session 2
RoR 101: Session 2
 
Ruby On Rails Tutorial
Ruby On Rails TutorialRuby On Rails Tutorial
Ruby On Rails Tutorial
 
JRuby + Rails = Awesome Java Web Framework at Jfokus 2011
JRuby + Rails = Awesome Java Web Framework at Jfokus 2011JRuby + Rails = Awesome Java Web Framework at Jfokus 2011
JRuby + Rails = Awesome Java Web Framework at Jfokus 2011
 
Intro to Rails and MVC
Intro to Rails and MVCIntro to Rails and MVC
Intro to Rails and MVC
 
Introduction To Ruby On Rails
Introduction To Ruby On RailsIntroduction To Ruby On Rails
Introduction To Ruby On Rails
 

More from arman o

Fundamentals of Lean Six Sigma
Fundamentals of Lean Six SigmaFundamentals of Lean Six Sigma
Fundamentals of Lean Six Sigmaarman o
 
Arman Ortega - Lean W0
Arman Ortega - Lean W0Arman Ortega - Lean W0
Arman Ortega - Lean W0arman o
 
Arman Ortega - CMMI Overview and Level 2-3 Training
Arman Ortega - CMMI Overview and Level 2-3 TrainingArman Ortega - CMMI Overview and Level 2-3 Training
Arman Ortega - CMMI Overview and Level 2-3 Trainingarman o
 
Arman Ortega - Using Docker
Arman Ortega - Using DockerArman Ortega - Using Docker
Arman Ortega - Using Dockerarman o
 
Arman Ortega - Advanced Javascript
Arman Ortega - Advanced JavascriptArman Ortega - Advanced Javascript
Arman Ortega - Advanced Javascriptarman o
 
Arman Ortega - Javascript using MEAN
Arman Ortega - Javascript using MEANArman Ortega - Javascript using MEAN
Arman Ortega - Javascript using MEANarman o
 
Arman Ortega - Building Web App with Node js
Arman Ortega - Building Web App with Node jsArman Ortega - Building Web App with Node js
Arman Ortega - Building Web App with Node jsarman o
 
Arman Ortega - PHP5 Tutorial
Arman Ortega - PHP5 TutorialArman Ortega - PHP5 Tutorial
Arman Ortega - PHP5 Tutorialarman o
 
Arman Ortega - API Connect Overview
Arman Ortega - API Connect OverviewArman Ortega - API Connect Overview
Arman Ortega - API Connect Overviewarman o
 
Arman Ortega - PHP Web App Security
Arman Ortega - PHP Web App SecurityArman Ortega - PHP Web App Security
Arman Ortega - PHP Web App Securityarman o
 
Learning Javascript Design Patterns
Learning Javascript Design PatternsLearning Javascript Design Patterns
Learning Javascript Design Patternsarman o
 
Arman Ortega - Intro to Mongodb using MEAN Stack edx
Arman Ortega - Intro to Mongodb using MEAN Stack edxArman Ortega - Intro to Mongodb using MEAN Stack edx
Arman Ortega - Intro to Mongodb using MEAN Stack edxarman o
 
Arman Ortega - Ruby programming
Arman Ortega - Ruby programmingArman Ortega - Ruby programming
Arman Ortega - Ruby programmingarman o
 
Arman Ortega - Javascript tutorials W3Schools
Arman Ortega - Javascript tutorials W3SchoolsArman Ortega - Javascript tutorials W3Schools
Arman Ortega - Javascript tutorials W3Schoolsarman o
 
Arman Ortega - Ruby on Rails 4.2 Certificate
Arman Ortega - Ruby on Rails 4.2 CertificateArman Ortega - Ruby on Rails 4.2 Certificate
Arman Ortega - Ruby on Rails 4.2 Certificatearman o
 
Arman Ortega - Fundamentals of Javascripts
Arman Ortega - Fundamentals of JavascriptsArman Ortega - Fundamentals of Javascripts
Arman Ortega - Fundamentals of Javascriptsarman o
 
Arman Ortega - DevOps Foundation
Arman Ortega - DevOps FoundationArman Ortega - DevOps Foundation
Arman Ortega - DevOps Foundationarman o
 
Arman Ortega - Python | Codeacademy
Arman Ortega - Python | CodeacademyArman Ortega - Python | Codeacademy
Arman Ortega - Python | Codeacademyarman o
 
GDG Cebu Code Camp Certificate
GDG Cebu Code Camp CertificateGDG Cebu Code Camp Certificate
GDG Cebu Code Camp Certificatearman o
 
Certificate of Academic Recognition - Outstanding performance in Computer Fun...
Certificate of Academic Recognition - Outstanding performance in Computer Fun...Certificate of Academic Recognition - Outstanding performance in Computer Fun...
Certificate of Academic Recognition - Outstanding performance in Computer Fun...arman o
 

More from arman o (20)

Fundamentals of Lean Six Sigma
Fundamentals of Lean Six SigmaFundamentals of Lean Six Sigma
Fundamentals of Lean Six Sigma
 
Arman Ortega - Lean W0
Arman Ortega - Lean W0Arman Ortega - Lean W0
Arman Ortega - Lean W0
 
Arman Ortega - CMMI Overview and Level 2-3 Training
Arman Ortega - CMMI Overview and Level 2-3 TrainingArman Ortega - CMMI Overview and Level 2-3 Training
Arman Ortega - CMMI Overview and Level 2-3 Training
 
Arman Ortega - Using Docker
Arman Ortega - Using DockerArman Ortega - Using Docker
Arman Ortega - Using Docker
 
Arman Ortega - Advanced Javascript
Arman Ortega - Advanced JavascriptArman Ortega - Advanced Javascript
Arman Ortega - Advanced Javascript
 
Arman Ortega - Javascript using MEAN
Arman Ortega - Javascript using MEANArman Ortega - Javascript using MEAN
Arman Ortega - Javascript using MEAN
 
Arman Ortega - Building Web App with Node js
Arman Ortega - Building Web App with Node jsArman Ortega - Building Web App with Node js
Arman Ortega - Building Web App with Node js
 
Arman Ortega - PHP5 Tutorial
Arman Ortega - PHP5 TutorialArman Ortega - PHP5 Tutorial
Arman Ortega - PHP5 Tutorial
 
Arman Ortega - API Connect Overview
Arman Ortega - API Connect OverviewArman Ortega - API Connect Overview
Arman Ortega - API Connect Overview
 
Arman Ortega - PHP Web App Security
Arman Ortega - PHP Web App SecurityArman Ortega - PHP Web App Security
Arman Ortega - PHP Web App Security
 
Learning Javascript Design Patterns
Learning Javascript Design PatternsLearning Javascript Design Patterns
Learning Javascript Design Patterns
 
Arman Ortega - Intro to Mongodb using MEAN Stack edx
Arman Ortega - Intro to Mongodb using MEAN Stack edxArman Ortega - Intro to Mongodb using MEAN Stack edx
Arman Ortega - Intro to Mongodb using MEAN Stack edx
 
Arman Ortega - Ruby programming
Arman Ortega - Ruby programmingArman Ortega - Ruby programming
Arman Ortega - Ruby programming
 
Arman Ortega - Javascript tutorials W3Schools
Arman Ortega - Javascript tutorials W3SchoolsArman Ortega - Javascript tutorials W3Schools
Arman Ortega - Javascript tutorials W3Schools
 
Arman Ortega - Ruby on Rails 4.2 Certificate
Arman Ortega - Ruby on Rails 4.2 CertificateArman Ortega - Ruby on Rails 4.2 Certificate
Arman Ortega - Ruby on Rails 4.2 Certificate
 
Arman Ortega - Fundamentals of Javascripts
Arman Ortega - Fundamentals of JavascriptsArman Ortega - Fundamentals of Javascripts
Arman Ortega - Fundamentals of Javascripts
 
Arman Ortega - DevOps Foundation
Arman Ortega - DevOps FoundationArman Ortega - DevOps Foundation
Arman Ortega - DevOps Foundation
 
Arman Ortega - Python | Codeacademy
Arman Ortega - Python | CodeacademyArman Ortega - Python | Codeacademy
Arman Ortega - Python | Codeacademy
 
GDG Cebu Code Camp Certificate
GDG Cebu Code Camp CertificateGDG Cebu Code Camp Certificate
GDG Cebu Code Camp Certificate
 
Certificate of Academic Recognition - Outstanding performance in Computer Fun...
Certificate of Academic Recognition - Outstanding performance in Computer Fun...Certificate of Academic Recognition - Outstanding performance in Computer Fun...
Certificate of Academic Recognition - Outstanding performance in Computer Fun...
 

Recently uploaded

Fields in Java and Kotlin and what to expect.pptx
Fields in Java and Kotlin and what to expect.pptxFields in Java and Kotlin and what to expect.pptx
Fields in Java and Kotlin and what to expect.pptxJoão Esperancinha
 
Enterprise Document Management System - Qualityze Inc
Enterprise Document Management System - Qualityze IncEnterprise Document Management System - Qualityze Inc
Enterprise Document Management System - Qualityze Incrobinwilliams8624
 
Cybersecurity Challenges with Generative AI - for Good and Bad
Cybersecurity Challenges with Generative AI - for Good and BadCybersecurity Challenges with Generative AI - for Good and Bad
Cybersecurity Challenges with Generative AI - for Good and BadIvo Andreev
 
Vectors are the new JSON in PostgreSQL (SCaLE 21x)
Vectors are the new JSON in PostgreSQL (SCaLE 21x)Vectors are the new JSON in PostgreSQL (SCaLE 21x)
Vectors are the new JSON in PostgreSQL (SCaLE 21x)Jonathan Katz
 
Rejekts 24 EU No GitOps Pain, No Platform Gain
Rejekts 24 EU No GitOps Pain, No Platform GainRejekts 24 EU No GitOps Pain, No Platform Gain
Rejekts 24 EU No GitOps Pain, No Platform GainŁukasz Piątkowski
 
Big Data Bellevue Meetup | Enhancing Python Data Loading in the Cloud for AI/ML
Big Data Bellevue Meetup | Enhancing Python Data Loading in the Cloud for AI/MLBig Data Bellevue Meetup | Enhancing Python Data Loading in the Cloud for AI/ML
Big Data Bellevue Meetup | Enhancing Python Data Loading in the Cloud for AI/MLAlluxio, Inc.
 
Generative AI for Cybersecurity - EC-Council
Generative AI for Cybersecurity - EC-CouncilGenerative AI for Cybersecurity - EC-Council
Generative AI for Cybersecurity - EC-CouncilVICTOR MAESTRE RAMIREZ
 
How to Improve the Employee Experience? - HRMS Software
How to Improve the Employee Experience? - HRMS SoftwareHow to Improve the Employee Experience? - HRMS Software
How to Improve the Employee Experience? - HRMS SoftwareNYGGS Automation Suite
 
Kawika Technologies pvt ltd Software Development Company in Trivandrum
Kawika Technologies pvt ltd Software Development Company in TrivandrumKawika Technologies pvt ltd Software Development Company in Trivandrum
Kawika Technologies pvt ltd Software Development Company in TrivandrumKawika Technologies
 
Streamlining Your Application Builds with Cloud Native Buildpacks
Streamlining Your Application Builds  with Cloud Native BuildpacksStreamlining Your Application Builds  with Cloud Native Buildpacks
Streamlining Your Application Builds with Cloud Native BuildpacksVish Abrams
 
Use a Referral Program to Get 1 Million Users Waiting To Try Your App Before ...
Use a Referral Program to Get 1 Million Users Waiting To Try Your App Before ...Use a Referral Program to Get 1 Million Users Waiting To Try Your App Before ...
Use a Referral Program to Get 1 Million Users Waiting To Try Your App Before ...Flyyx Tech
 
How Does the Epitome of Spyware Differ from Other Malicious Software?
How Does the Epitome of Spyware Differ from Other Malicious Software?How Does the Epitome of Spyware Differ from Other Malicious Software?
How Does the Epitome of Spyware Differ from Other Malicious Software?AmeliaSmith90
 
IA Generativa y Grafos de Neo4j: RAG time
IA Generativa y Grafos de Neo4j: RAG timeIA Generativa y Grafos de Neo4j: RAG time
IA Generativa y Grafos de Neo4j: RAG timeNeo4j
 
JS-Experts - Cybersecurity for Generative AI
JS-Experts - Cybersecurity for Generative AIJS-Experts - Cybersecurity for Generative AI
JS-Experts - Cybersecurity for Generative AIIvo Andreev
 
Deep Learning for Images with PyTorch - Datacamp
Deep Learning for Images with PyTorch - DatacampDeep Learning for Images with PyTorch - Datacamp
Deep Learning for Images with PyTorch - DatacampVICTOR MAESTRE RAMIREZ
 
eAuditor Audits & Inspections - conduct field inspections
eAuditor Audits & Inspections - conduct field inspectionseAuditor Audits & Inspections - conduct field inspections
eAuditor Audits & Inspections - conduct field inspectionsNirav Modi
 
OpenChain Webinar: Universal CVSS Calculator
OpenChain Webinar: Universal CVSS CalculatorOpenChain Webinar: Universal CVSS Calculator
OpenChain Webinar: Universal CVSS CalculatorShane Coughlan
 
ERP For Electrical and Electronics manufecturing.pptx
ERP For Electrical and Electronics manufecturing.pptxERP For Electrical and Electronics manufecturing.pptx
ERP For Electrical and Electronics manufecturing.pptxAutus Cyber Tech
 
Watermarking in Source Code: Applications and Security Challenges
Watermarking in Source Code: Applications and Security ChallengesWatermarking in Source Code: Applications and Security Challenges
Watermarking in Source Code: Applications and Security ChallengesShyamsundar Das
 

Recently uploaded (20)

Fields in Java and Kotlin and what to expect.pptx
Fields in Java and Kotlin and what to expect.pptxFields in Java and Kotlin and what to expect.pptx
Fields in Java and Kotlin and what to expect.pptx
 
Enterprise Document Management System - Qualityze Inc
Enterprise Document Management System - Qualityze IncEnterprise Document Management System - Qualityze Inc
Enterprise Document Management System - Qualityze Inc
 
Cybersecurity Challenges with Generative AI - for Good and Bad
Cybersecurity Challenges with Generative AI - for Good and BadCybersecurity Challenges with Generative AI - for Good and Bad
Cybersecurity Challenges with Generative AI - for Good and Bad
 
Vectors are the new JSON in PostgreSQL (SCaLE 21x)
Vectors are the new JSON in PostgreSQL (SCaLE 21x)Vectors are the new JSON in PostgreSQL (SCaLE 21x)
Vectors are the new JSON in PostgreSQL (SCaLE 21x)
 
Rejekts 24 EU No GitOps Pain, No Platform Gain
Rejekts 24 EU No GitOps Pain, No Platform GainRejekts 24 EU No GitOps Pain, No Platform Gain
Rejekts 24 EU No GitOps Pain, No Platform Gain
 
Big Data Bellevue Meetup | Enhancing Python Data Loading in the Cloud for AI/ML
Big Data Bellevue Meetup | Enhancing Python Data Loading in the Cloud for AI/MLBig Data Bellevue Meetup | Enhancing Python Data Loading in the Cloud for AI/ML
Big Data Bellevue Meetup | Enhancing Python Data Loading in the Cloud for AI/ML
 
Salesforce AI Associate Certification.pptx
Salesforce AI Associate Certification.pptxSalesforce AI Associate Certification.pptx
Salesforce AI Associate Certification.pptx
 
Generative AI for Cybersecurity - EC-Council
Generative AI for Cybersecurity - EC-CouncilGenerative AI for Cybersecurity - EC-Council
Generative AI for Cybersecurity - EC-Council
 
How to Improve the Employee Experience? - HRMS Software
How to Improve the Employee Experience? - HRMS SoftwareHow to Improve the Employee Experience? - HRMS Software
How to Improve the Employee Experience? - HRMS Software
 
Kawika Technologies pvt ltd Software Development Company in Trivandrum
Kawika Technologies pvt ltd Software Development Company in TrivandrumKawika Technologies pvt ltd Software Development Company in Trivandrum
Kawika Technologies pvt ltd Software Development Company in Trivandrum
 
Streamlining Your Application Builds with Cloud Native Buildpacks
Streamlining Your Application Builds  with Cloud Native BuildpacksStreamlining Your Application Builds  with Cloud Native Buildpacks
Streamlining Your Application Builds with Cloud Native Buildpacks
 
Use a Referral Program to Get 1 Million Users Waiting To Try Your App Before ...
Use a Referral Program to Get 1 Million Users Waiting To Try Your App Before ...Use a Referral Program to Get 1 Million Users Waiting To Try Your App Before ...
Use a Referral Program to Get 1 Million Users Waiting To Try Your App Before ...
 
How Does the Epitome of Spyware Differ from Other Malicious Software?
How Does the Epitome of Spyware Differ from Other Malicious Software?How Does the Epitome of Spyware Differ from Other Malicious Software?
How Does the Epitome of Spyware Differ from Other Malicious Software?
 
IA Generativa y Grafos de Neo4j: RAG time
IA Generativa y Grafos de Neo4j: RAG timeIA Generativa y Grafos de Neo4j: RAG time
IA Generativa y Grafos de Neo4j: RAG time
 
JS-Experts - Cybersecurity for Generative AI
JS-Experts - Cybersecurity for Generative AIJS-Experts - Cybersecurity for Generative AI
JS-Experts - Cybersecurity for Generative AI
 
Deep Learning for Images with PyTorch - Datacamp
Deep Learning for Images with PyTorch - DatacampDeep Learning for Images with PyTorch - Datacamp
Deep Learning for Images with PyTorch - Datacamp
 
eAuditor Audits & Inspections - conduct field inspections
eAuditor Audits & Inspections - conduct field inspectionseAuditor Audits & Inspections - conduct field inspections
eAuditor Audits & Inspections - conduct field inspections
 
OpenChain Webinar: Universal CVSS Calculator
OpenChain Webinar: Universal CVSS CalculatorOpenChain Webinar: Universal CVSS Calculator
OpenChain Webinar: Universal CVSS Calculator
 
ERP For Electrical and Electronics manufecturing.pptx
ERP For Electrical and Electronics manufecturing.pptxERP For Electrical and Electronics manufecturing.pptx
ERP For Electrical and Electronics manufecturing.pptx
 
Watermarking in Source Code: Applications and Security Challenges
Watermarking in Source Code: Applications and Security ChallengesWatermarking in Source Code: Applications and Security Challenges
Watermarking in Source Code: Applications and Security Challenges
 

Introduction to Rails - presented by Arman Ortega

  • 1. Introduction to Ruby on Rails Presented by: Arman Ortega rubyonrails.org
  • 2. What you'll learn ➔ Overview of Ruby ➔ Overview of Rails ➔ Convention over Configuration ➔ CRUD – Create, Read, Update & Delete ➔ Sample Rails app (Blog) ➔ Short Activity (railszombies.org)
  • 3. Ruby is object oriented  Everything is an object. Integers, Floats, Booleans, Strings, Arrays, Hash – all are objects.  Ruby is simple, elegant & natural syntax  Inspired by Perl, Python, LISP  Less lines of code, higher productivity In PHP: function say_hi($name) { $out = "Hi $name "; return $out; } say_hi("Michelle"); In Ruby: def say_hi name out = "Hi #{name} " out end say_hi "Michelle"
  • 4. Interactive Ruby (irb) irb(main):001:0> s = "Hello World" => "Hello World" irb(main):002:0> s.length => 11 irb(main):003:0> s.upcase => "HELLO WORLD" irb(main):004:0> s.downcase => "hello world" irb(main):005:0> s.downcase.reverse => "dlrow olleh" irb(main):006:0> n = 2 + 3 => 5 irb(main):007:0> n.class => Fixnum irb(main):008:0> 5.times { print s } Hello WorldHello WorldHello WorldHello WorldHello World C:Ruby193bin>irb Provides a shell(command prompt) for experimentation. String method String class Fixnum class
  • 5. Arrays - are ordered, integer-indexed collections of any object. Indexing starts at 0, as in C or Java. e.g. pet = Array.new or [] irb> pet = ["dog", "cat", "mouse"] irb> pet.count => 3 irb> pet.index("cat") => 1 irb> pet[2] => "mouse" Hashes - is a collection of key-value pairs. e.g. style = Hash.new or {} irb> style = { "font_size" => 10, "font_family" => "Arial" } => {"font_size"=>10, "font_family"=>"Arial"} irb> style["font_size"] => 10 Arrays & Hashes
  • 6. More about Ruby http://tryruby.org – an interactive tutorial https://www.ruby-lang.org/en/documentation
  • 7. What is Rails?  Rails is an open-source web framework that’s optimized for programmer happiness and sustainable productivity.  Less lines of code, higher productivity.  It is an MVC web framework where Models, Views and Controllers are fully integrated.  Written in Ruby language. http://rubyonrails.org/ https://www.ruby-lang.org/en/
  • 8. Overview of Rails  Convention over Configuration  ActiveRecord – is the M in MVC – the model. – It is the Object/Relational Mapping (ORM) layer supplied with Rails. It closely follows the standard ORM model such as: * tables map to classes * columns map to object attributes * rows map to objects id title body 1 hello world Table: articles a = Article.new Object attribute a.title
  • 9. Convention over Configuration Database Table - Plural with underscores separating words (e.g. articles, asset_images ) Model Class - Singular with the first letter of each word capitalized (e.g. Article, AssetImage) Filenames are written in lowercase, with underscores separating each word. id int(11) title varchar(255) body text created_at datetime updated_at datetime Table: articles class Article < ActiveRecord::Base . . . end File: models/article.rb Class name Filename UserController user_controller.rb StatusMessagesController status_messages_controller.rb RemoteUploader remote_uploader.rb Another example: Example:
  • 10. CRUD: Create, Read, Update & Delete Create example: a = Article.new a.title = "hello" a.body = "world" a.save Read ModelClass.find(id) example: Article.find(1) ModelClass.where() example: Article.where("title = ?", "MH17") m = ModelClass.new m.attribute = value m.save syntax: More details: http://guides.rubyonrails.org/active_record_basics.html
  • 11. CRUD: Create, Read, Update & Delete Update m = ModelClass.find_by(field: value) m.attribute = value m.save example: a = Article.find_by(id: 1) a.title = "hello" a.body = "world" a.save Delete a = ModelClass.find_by(field: value) a.destroy example: a = Article.find_by(title:"hi") a.destroy m = ModelClass.find_by(field1:value, field2: value) m.update(field1: value1, field2: value2) m = Article.find_by(title: "lorem1", body: "lorem1") m.update(title: "lorem2", body: "lorem2") Alternative way
  • 12. Installing Rails For Windows  Rails Installer 2.2.3 (http://railsinstaller.org/en) Packages included are: Ruby Rails Bundler -manage your gem dependencies Git . . .  XAMPP 1.8.2 (https://www.apachefriends.org/download.html) Packages included are: Apache 2 MySQL 5.6 PHP 5 phpMyAdmin . . . For Linux, see the links below on how to install Rails on Linux http://coding.smashingmagazine.com/2011/06/21/set-up-an-ubuntu-local-development-machine-for-ruby-on-rails/ http://www.computersnyou.com/1535/2013/03/installing-ruby-on-rail-on-ubuntu-with-rbenv-step-by-step/ https://help.ubuntu.com/community/RubyOnRails
  • 13. Step 1 of 3 Step 2 of 3 Step 3 of 3 How to verify the load path in Ruby? > ruby -e 'puts $:' C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1 C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/i386-msvcrt C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby C:/RailsInstaller/Ruby1.9.3/lib/ruby/vendor_ruby/1.9.1 C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1 C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/i386-mingw32 Installing Rails Installer on Windows
  • 15. Some common errors during setup Problem: Error installing mysql2: ERROR: Failed to build gem native extension. Solution: > gem install mysql2 -- '--with-mysql-lib="C:xamppmysqllib" --with- mysql-include="C:xamppmysqlinclude"' Problem: Incorrect MySQL client library version! This gem was compiled for 5.6.16 but the client library is 5.5.27. (RuntimeError) Solution: You need to copy libmysql.dll from MySQL installation directory(e.g. c:>xamppmysqllib) and paste it to C:RailsInstaller2.2.3Ruby1.9.3bin
  • 16. Sample Rails app (blog) > rails new APP_NAME --database=mysql e.g. rails new blog --database=mysql create create README.rdoc create Rakefile create config.ru create .gitignore create Gemfile create app create app/assets/javascripts/application.js create app/assets/stylesheets/application.css create app/controllers/application_controller.rb create app/helpers/application_helper.rb create app/views/layouts/application.html.erb . . . run bundle install Fetching gem metadata from https://rubygems.org/........... Fetching additional metadata from https://rubygems.org/.. Resolving dependencies... Using rake 10.3.2 Using i18n 0.6.11 Using activerecord 4.1.4 Using bundler 1.6.2 . . . Your bundle is complete!
  • 17. Rails directory structure +-app | +-assets | | +-images | | +-javascripts | | +-stylesheets | +-controllers | +-helpers | +-mailers | +-models | +-views +-config (database.yml, routes.rb, application.rb, etc) +-db (migration files) +-lib +-log (log files used for debugging) +-public (404.html, favicon.ico, robots.txt) +-test +-vendor (third-party javascripts/css like twitter-bootstrap or jquery ) +-images +-javascripts +-stylesheets Gemfile README.rdoc
  • 18. config/database.yml development: adapter: mysql2 database: blog_dev username: root password: host: localhost test: adapter: mysql2 database: blog_test username: root password: host: localhost production: adapter: mysql2 database: blog_prod username: root password: host: localhost After configuring the database.yml. Then, let's create all databases > rake db:create:all Rake is used for common administration tasks. Sample rake commands are: > rake db:migrate RAILS_ENV=development > rake db:create:all > rake routes To run the app C:railsappAPP_NAME> rails s
  • 19. config/routes.rb Rails.application.routes.draw do get 'articles/add', to: 'articles#add', as: 'articles_add' get 'articles/:id', to: 'articles#details', as: 'articles_details' get 'articles/:id/edit', to: 'articles#edit', as: 'articles_edit' get 'articles/:id/delete', to: 'articles#delete', as: 'articles_delete' post 'articles/save', to: 'articles#save', as: 'articles_save' post 'articles/update', to: 'articles#update', as: 'articles_update' get 'welcome/index', to: 'welcome#index', as: 'welcome_index' root 'welcome#index' end
  • 20. Router In controller: def details @article = Article.find params[:id] end The Rails router recognizes URLs and dispatches them to a controller's action. GET articles/1 In routes.rb get '/articles/:id', to: 'articles#details', as: 'articles_details' get 'welcome/index', to: 'welcome#index', as: 'welcome_index' . . . In views: <div class="article"> <em><%= time_ago_in_words(@article.updated_at) %> ago</em> <h3><%= @article.title %></h3> <p><%= @article.body %></p> <%= link_to "<<Back to Home", welcome_index_path %> </div>
  • 21. Running the app 'rails server' or 'rails s' command > rails s => BootingWEBrick => Rails 4.1.4 application starting in development on http://0.0.0.0:3000 => Run `rails server -h` for more startup options => Notice: server is listening on all interfaces (0.0.0.0). Consider using 127.0.0.1 (--binding option) => Ctrl-C to shutdown server
  • 22. Creating a Controller 'rails generate' or 'rails g' command rails generate controller <NAME> <action1> <action2> . . . e.g. > rails generate controller Welcome index create app/controllers/welcome_controller.rb route get 'welcome/index‘ invoke erb create app/views/welcome create app/views/welcome/index.html.erb . . . > rails generate controller Articles add save edit update create app/controllers/articles_controller.rb route get 'articles/update' route get 'articles/edit' route get 'articles/add' invoke erb create app/views/articles create app/views/articles/add.html.erb create app/views/articles/edit.html.erb create app/views/articles/delete.html.erb . . . More info: http://guides.rubyonrails.org/command_line.html#rails-generate
  • 23. Creating a Model rails generate model <MODEL_NAME> <field1:type> <field2:type> . . . e.g. > rails generate model Article title:string body:text invoke active_record create db/migrate/20140705184622_create_articles.rb create app/models/article.rb . . . . . . File: db/migrate/20140705184622_create_articles.rb File: app/models/article.rb
  • 24. Creating a views File: views/articles/add.html.erb More info: http://guides.rubyonrails.org/form_helpers.html
  • 25. Useful links  https://www.ruby-lang.org/en/documentation/  http://guides.rubyonrails.org/getting_started.html  http://tryruby.org  http://railsforzombies.org
  • 27. 8/8/14 1 Introduction to Ruby on Rails Presented by: Arman Ortega rubyonrails.org
  • 28. 8/8/14 2 What you'll learn ➔ Overview of Ruby ➔ Overview of Rails ➔ Convention over Configuration ➔ CRUD – Create, Read, Update & Delete ➔ Sample Rails app (Blog) ➔ Short Activity (railszombies.org)
  • 29. 8/8/14 3 Ruby is object oriented  Everything is an object. Integers, Floats, Booleans, Strings, Arrays, Hash – all are objects.  Ruby is simple, elegant & natural syntax  Inspired by Perl, Python, LISP  Less lines of code, higher productivity In PHP: function say_hi($name) { $out = "Hi $name "; return $out; } say_hi("Michelle"); In Ruby: def say_hi name out = "Hi #{name} " out end say_hi "Michelle"
  • 30. 8/8/14 4 Interactive Ruby (irb) irb(main):001:0> s = "Hello World" => "Hello World" irb(main):002:0> s.length => 11 irb(main):003:0> s.upcase => "HELLO WORLD" irb(main):004:0> s.downcase => "hello world" irb(main):005:0> s.downcase.reverse => "dlrow olleh" irb(main):006:0> n = 2 + 3 => 5 irb(main):007:0> n.class => Fixnum irb(main):008:0> 5.times { print s } Hello WorldHello WorldHello WorldHello WorldHello World C:Ruby193bin>irb Provides a shell(command prompt) for experimentation. String method String class Fixnum class
  • 31. 8/8/14 5 Arrays - are ordered, integer-indexed collections of any object. Indexing starts at 0, as in C or Java. e.g. pet = Array.new or [] irb> pet = ["dog", "cat", "mouse"] irb> pet.count => 3 irb> pet.index("cat") => 1 irb> pet[2] => "mouse" Hashes - is a collection of key-value pairs. e.g. style = Hash.new or {} irb> style = { "font_size" => 10, "font_family" => "Arial" } => {"font_size"=>10, "font_family"=>"Arial"} irb> style["font_size"] => 10 Arrays & Hashes
  • 32. 8/8/14 6 More about Ruby http://tryruby.org – an interactive tutorial https://www.ruby-lang.org/en/documentation
  • 33. 8/8/14 7 What is Rails?  Rails is an open-source web framework that’s optimized for programmer happiness and sustainable productivity.  Less lines of code, higher productivity.  It is an MVC web framework where Models, Views and Controllers are fully integrated.  Written in Ruby language. http://rubyonrails.org/ https://www.ruby-lang.org/en/
  • 34. 8/8/14 8 Overview of Rails  Convention over Configuration  ActiveRecord – is the M in MVC – the model. – It is the Object/Relational Mapping (ORM) layer supplied with Rails. It closely follows the standard ORM model such as: * tables map to classes * columns map to object attributes * rows map to objects id title body 1 hello world Table: articles a = Article.new Object attribute a.title
  • 35. 8/8/14 9 Convention over Configuration Database Table - Plural with underscores separating words (e.g. articles, asset_images ) Model Class - Singular with the first letter of each word capitalized (e.g. Article, AssetImage) Filenames are written in lowercase, with underscores separating each word. id int(11) title varchar(255) body text created_at datetime updated_at datetime Table: articles class Article < ActiveRecord::Base . . . end File: models/article.rb Class name Filename UserController user_controller.rb StatusMessagesController status_messages_controller.rb RemoteUploader remote_uploader.rb Another example: Example:
  • 36. 8/8/14 10 CRUD: Create, Read, Update & Delete Create example: a = Article.new a.title = "hello" a.body = "world" a.save Read ModelClass.find(id) example: Article.find(1) ModelClass.where() example: Article.where("title = ?", "MH17") m = ModelClass.new m.attribute = value m.save syntax: More details: http://guides.rubyonrails.org/active_record_basics.html
  • 37. 8/8/14 11 CRUD: Create, Read, Update & Delete Update m = ModelClass.find_by(field: value) m.attribute = value m.save example: a = Article.find_by(id: 1) a.title = "hello" a.body = "world" a.save Delete a = ModelClass.find_by(field: value) a.destroy example: a = Article.find_by(title:"hi") a.destroy m = ModelClass.find_by(field1:value, field2: value) m.update(field1: value1, field2: value2) m = Article.find_by(title: "lorem1", body: "lorem1") m.update(title: "lorem2", body: "lorem2") Alternative way
  • 38. 8/8/14 12 Installing Rails For Windows  Rails Installer 2.2.3 (http://railsinstaller.org/en) Packages included are: Ruby Rails Bundler -manage your gem dependencies Git . . .  XAMPP 1.8.2 (https://www.apachefriends.org/download.html) Packages included are: Apache 2 MySQL 5.6 PHP 5 phpMyAdmin . . . For Linux, see the links below on how to install Rails on Linux http://coding.smashingmagazine.com/2011/06/21/set-up-an-ubuntu-local-development-machine-for-ruby-on-rails/ http://www.computersnyou.com/1535/2013/03/installing-ruby-on-rail-on-ubuntu-with-rbenv-step-by-step/ https://help.ubuntu.com/community/RubyOnRails
  • 39. 8/8/14 13 Step 1 of 3 Step 2 of 3 Step 3 of 3 How to verify the load path in Ruby? > ruby -e 'puts $:' C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1 C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/i386-msvcrt C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby C:/RailsInstaller/Ruby1.9.3/lib/ruby/vendor_ruby/1.9.1 C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1 C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/i386-mingw32 Installing Rails Installer on Windows
  • 41. 8/8/14 15 Some common errors during setup Problem: Error installing mysql2: ERROR: Failed to build gem native extension. Solution: > gem install mysql2 -- '--with-mysql-lib="C:xamppmysqllib" --with- mysql-include="C:xamppmysqlinclude"' Problem: Incorrect MySQL client library version! This gem was compiled for 5.6.16 but the client library is 5.5.27. (RuntimeError) Solution: You need to copy libmysql.dll from MySQL installation directory(e.g. c:>xamppmysqllib) and paste it to C:RailsInstaller2.2.3Ruby1.9.3bin
  • 42. 8/8/14 16 Sample Rails app (blog) > rails new APP_NAME --database=mysql e.g. rails new blog --database=mysql create create README.rdoc create Rakefile create config.ru create .gitignore create Gemfile create app create app/assets/javascripts/application.js create app/assets/stylesheets/application.css create app/controllers/application_controller.rb create app/helpers/application_helper.rb create app/views/layouts/application.html.erb . . . run bundle install Fetching gem metadata from https://rubygems.org/........... Fetching additional metadata from https://rubygems.org/.. Resolving dependencies... Using rake 10.3.2 Using i18n 0.6.11 Using activerecord 4.1.4 Using bundler 1.6.2 . . . Your bundle is complete!
  • 43. 8/8/14 17 Rails directory structure +-app | +-assets | | +-images | | +-javascripts | | +-stylesheets | +-controllers | +-helpers | +-mailers | +-models | +-views +-config (database.yml, routes.rb, application.rb, etc) +-db (migration files) +-lib +-log (log files used for debugging) +-public (404.html, favicon.ico, robots.txt) +-test +-vendor (third-party javascripts/css like twitter-bootstrap or jquery ) +-images +-javascripts +-stylesheets Gemfile README.rdoc
  • 44. 8/8/14 18 config/database.yml development: adapter: mysql2 database: blog_dev username: root password: host: localhost test: adapter: mysql2 database: blog_test username: root password: host: localhost production: adapter: mysql2 database: blog_prod username: root password: host: localhost After configuring the database.yml. Then, let's create all databases > rake db:create:all Rake is used for common administration tasks. Sample rake commands are: > rake db:migrate RAILS_ENV=development > rake db:create:all > rake routes To run the app C:railsappAPP_NAME> rails s
  • 45. 8/8/14 19 config/routes.rb Rails.application.routes.draw do get 'articles/add', to: 'articles#add', as: 'articles_add' get 'articles/:id', to: 'articles#details', as: 'articles_details' get 'articles/:id/edit', to: 'articles#edit', as: 'articles_edit' get 'articles/:id/delete', to: 'articles#delete', as: 'articles_delete' post 'articles/save', to: 'articles#save', as: 'articles_save' post 'articles/update', to: 'articles#update', as: 'articles_update' get 'welcome/index', to: 'welcome#index', as: 'welcome_index' root 'welcome#index' end
  • 46. 8/8/14 20 Router In controller: def details @article = Article.find params[:id] end The Rails router recognizes URLs and dispatches them to a controller's action. GET articles/1 In routes.rb get '/articles/:id', to: 'articles#details', as: 'articles_details' get 'welcome/index', to: 'welcome#index', as: 'welcome_index' . . . In views: <div class="article"> <em><%= time_ago_in_words(@article.updated_at) %> ago</em> <h3><%= @article.title %></h3> <p><%= @article.body %></p> <%= link_to "<<Back to Home", welcome_index_path %> </div>
  • 47. 8/8/14 21 Running the app 'rails server' or 'rails s' command > rails s => BootingWEBrick => Rails 4.1.4 application starting in development on http://0.0.0.0:3000 => Run `rails server -h` for more startup options => Notice: server is listening on all interfaces (0.0.0.0). Consider using 127.0.0.1 (--binding option) =>Ctrl-C to shutdown server
  • 48. 8/8/14 22 Creating a Controller 'rails generate' or 'rails g' command rails generate controller <NAME> <action1> <action2> . . . e.g. > rails generate controller Welcome index create app/controllers/welcome_controller.rb route get 'welcome/index‘ invoke erb create app/views/welcome create app/views/welcome/index.html.erb . . . > rails generate controller Articles add save edit update create app/controllers/articles_controller.rb route get 'articles/update' route get 'articles/edit' route get 'articles/add' invoke erb create app/views/articles create app/views/articles/add.html.erb create app/views/articles/edit.html.erb create app/views/articles/delete.html.erb . . . More info: http://guides.rubyonrails.org/command_line.html#rails-generate
  • 49. 8/8/14 23 Creating a Model rails generate model <MODEL_NAME> <field1:type> <field2:type> . . . e.g. > rails generate model Article title:string body:text invoke active_record create db/migrate/20140705184622_create_articles.rb create app/models/article.rb . . . . . . File: db/migrate/20140705184622_create_articles.rb File: app/models/article.rb
  • 50. 8/8/14 24 Creating a views File: views/articles/add.html.erb More info: http://guides.rubyonrails.org/form_helpers.html
  • 51. 8/8/14 25 Useful links  https://www.ruby-lang.org/en/documentation/  http://guides.rubyonrails.org/getting_started.html  http://tryruby.org  http://railsforzombies.org