SlideShare a Scribd company logo
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!
Ad

More Related Content

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
Adam Wiggins
 
Ruby on Rails Training - Module 1
Ruby on Rails Training - Module 1Ruby on Rails Training - Module 1
Ruby on Rails Training - Module 1
Mark 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 Framework
Jeremy Kendall
 
Sinatra for REST services
Sinatra for REST servicesSinatra for REST services
Sinatra for REST services
Emanuele DelBono
 
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
Shaer Hassan
 
Bullet: The Functional PHP Micro-Framework
Bullet: The Functional PHP Micro-FrameworkBullet: The Functional PHP Micro-Framework
Bullet: The Functional PHP Micro-Framework
Vance Lucas
 
Introduction to Ruby on Rails
Introduction to Ruby on RailsIntroduction to Ruby on Rails
Introduction to Ruby on Rails
Agnieszka Figiel
 
Ruby On Rails Basics
Ruby On Rails BasicsRuby On Rails Basics
Ruby On Rails Basics
Amit Solanki
 
Sinatra Rack And Middleware
Sinatra Rack And MiddlewareSinatra Rack And Middleware
Sinatra Rack And Middleware
Ben Schwarz
 
Ruby on Rails Presentation
Ruby on Rails PresentationRuby on Rails Presentation
Ruby on Rails Presentation
Michael MacDonald
 
Introduction to Ruby on Rails
Introduction to Ruby on RailsIntroduction to Ruby on Rails
Introduction to Ruby on Rails
Manoj 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 framework
Jeremy 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 Rails
dosire
 
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
vvaswani
 
Slim RedBeanPHP and Knockout
Slim RedBeanPHP and KnockoutSlim RedBeanPHP and Knockout
Slim RedBeanPHP and Knockout
Vic 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 database
Rubyc Slides
 
More to RoC weibo
More to RoC weiboMore to RoC weibo
More to RoC weibo
shaokun
 
Ruby on Rails Presentation
Ruby on Rails PresentationRuby on Rails Presentation
Ruby on Rails Presentation
Joost Hietbrink
 
Lightweight Webservices with Sinatra and RestClient
Lightweight Webservices with Sinatra and RestClientLightweight Webservices with Sinatra and RestClient
Lightweight Webservices with Sinatra and RestClient
Adam Wiggins
 
Ruby on Rails Training - Module 1
Ruby on Rails Training - Module 1Ruby on Rails Training - Module 1
Ruby on Rails Training - Module 1
Mark 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 Framework
Jeremy 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 Jan09
Shaer Hassan
 
Bullet: The Functional PHP Micro-Framework
Bullet: The Functional PHP Micro-FrameworkBullet: The Functional PHP Micro-Framework
Bullet: The Functional PHP Micro-Framework
Vance Lucas
 
Introduction to Ruby on Rails
Introduction to Ruby on RailsIntroduction to Ruby on Rails
Introduction to Ruby on Rails
Agnieszka Figiel
 
Ruby On Rails Basics
Ruby On Rails BasicsRuby On Rails Basics
Ruby On Rails Basics
Amit Solanki
 
Sinatra Rack And Middleware
Sinatra Rack And MiddlewareSinatra Rack And Middleware
Sinatra Rack And Middleware
Ben Schwarz
 
Introduction to Ruby on Rails
Introduction to Ruby on RailsIntroduction to Ruby on Rails
Introduction to Ruby on Rails
Manoj 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 framework
Jeremy 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 Rails
dosire
 
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
vvaswani
 
Slim RedBeanPHP and Knockout
Slim RedBeanPHP and KnockoutSlim RedBeanPHP and Knockout
Slim RedBeanPHP and Knockout
Vic 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 database
Rubyc Slides
 
More to RoC weibo
More to RoC weiboMore to RoC weibo
More to RoC weibo
shaokun
 
Ruby on Rails Presentation
Ruby on Rails PresentationRuby on Rails Presentation
Ruby on Rails Presentation
Joost Hietbrink
 

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

Intro to Rack
Intro to RackIntro to Rack
Intro to Rack
Rubyc Slides
 
Building web framework with Rack
Building web framework with RackBuilding web framework with Rack
Building web framework with Rack
sickill
 
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 Rails
DelphiCon
 
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
gicappa
 
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
Nick Sieger
 
Ruby on Rails - Introduction
Ruby on Rails - IntroductionRuby on Rails - Introduction
Ruby on Rails - Introduction
Vagmi Mudumbai
 
Jasig Rubyon Rails
Jasig Rubyon RailsJasig Rubyon Rails
Jasig Rubyon Rails
Paul Pajo
 
Dev streams2
Dev streams2Dev streams2
Dev streams2
David Mc Donagh
 
Ruby On Rails
Ruby On RailsRuby On Rails
Ruby On Rails
Gautam Rege
 
Rail3 intro 29th_sep_surendran
Rail3 intro 29th_sep_surendranRail3 intro 29th_sep_surendran
Rail3 intro 29th_sep_surendran
SPRITLE SOFTWARE PRIVATE LIMIT ED
 
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
Henry S
 
Pourquoi ruby et rails déchirent
Pourquoi ruby et rails déchirentPourquoi ruby et rails déchirent
Pourquoi ruby et rails déchirent
Nicolas 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 2012
rivierarb
 
20120121 rbc rails_routing
20120121 rbc rails_routing20120121 rbc rails_routing
20120121 rbc rails_routing
Takeshi AKIMA
 
RoR 101: Session 2
RoR 101: Session 2RoR 101: Session 2
RoR 101: Session 2
Rory Gianni
 
Ruby On Rails Tutorial
Ruby On Rails TutorialRuby On Rails Tutorial
Ruby On Rails Tutorial
sunniboy
 
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
Nick Sieger
 
Intro to Rails and MVC
Intro to Rails and MVCIntro to Rails and MVC
Intro to Rails and MVC
Sarah Allen
 
Introduction To Ruby On Rails
Introduction To Ruby On RailsIntroduction To Ruby On Rails
Introduction To Ruby On Rails
Steve Keener
 
Building web framework with Rack
Building web framework with RackBuilding web framework with Rack
Building web framework with Rack
sickill
 
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 Rails
DelphiCon
 
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
gicappa
 
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
Nick Sieger
 
Ruby on Rails - Introduction
Ruby on Rails - IntroductionRuby on Rails - Introduction
Ruby on Rails - Introduction
Vagmi Mudumbai
 
Jasig Rubyon Rails
Jasig Rubyon RailsJasig Rubyon Rails
Jasig Rubyon Rails
Paul 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 3
Henry S
 
Pourquoi ruby et rails déchirent
Pourquoi ruby et rails déchirentPourquoi ruby et rails déchirent
Pourquoi ruby et rails déchirent
Nicolas 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 2012
rivierarb
 
20120121 rbc rails_routing
20120121 rbc rails_routing20120121 rbc rails_routing
20120121 rbc rails_routing
Takeshi AKIMA
 
RoR 101: Session 2
RoR 101: Session 2RoR 101: Session 2
RoR 101: Session 2
Rory Gianni
 
Ruby On Rails Tutorial
Ruby On Rails TutorialRuby On Rails Tutorial
Ruby On Rails Tutorial
sunniboy
 
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
Nick Sieger
 
Intro to Rails and MVC
Intro to Rails and MVCIntro to Rails and MVC
Intro to Rails and MVC
Sarah Allen
 
Introduction To Ruby On Rails
Introduction To Ruby On RailsIntroduction To Ruby On Rails
Introduction To Ruby On Rails
Steve Keener
 
Ad

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 o
 
Arman Ortega - Lean W0
Arman Ortega - Lean W0Arman Ortega - Lean W0
Arman Ortega - Lean W0
arman 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 Training
arman o
 
Arman Ortega - Using Docker
Arman Ortega - Using DockerArman Ortega - Using Docker
Arman Ortega - Using Docker
arman o
 
Arman Ortega - Advanced Javascript
Arman Ortega - Advanced JavascriptArman Ortega - Advanced Javascript
Arman Ortega - Advanced Javascript
arman o
 
Arman Ortega - Javascript using MEAN
Arman Ortega - Javascript using MEANArman Ortega - Javascript using MEAN
Arman Ortega - Javascript using MEAN
arman 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 js
arman o
 
Arman Ortega - PHP5 Tutorial
Arman Ortega - PHP5 TutorialArman Ortega - PHP5 Tutorial
Arman Ortega - PHP5 Tutorial
arman o
 
Arman Ortega - API Connect Overview
Arman Ortega - API Connect OverviewArman Ortega - API Connect Overview
Arman Ortega - API Connect Overview
arman o
 
Arman Ortega - PHP Web App Security
Arman Ortega - PHP Web App SecurityArman Ortega - PHP Web App Security
Arman Ortega - PHP Web App Security
arman o
 
Learning Javascript Design Patterns
Learning Javascript Design PatternsLearning Javascript Design Patterns
Learning Javascript Design Patterns
arman 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 edx
arman o
 
Arman Ortega - Ruby programming
Arman Ortega - Ruby programmingArman Ortega - Ruby programming
Arman Ortega - Ruby programming
arman o
 
Arman Ortega - Javascript tutorials W3Schools
Arman Ortega - Javascript tutorials W3SchoolsArman Ortega - Javascript tutorials W3Schools
Arman Ortega - Javascript tutorials W3Schools
arman 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 Certificate
arman o
 
Arman Ortega - Fundamentals of Javascripts
Arman Ortega - Fundamentals of JavascriptsArman Ortega - Fundamentals of Javascripts
Arman Ortega - Fundamentals of Javascripts
arman o
 
Arman Ortega - DevOps Foundation
Arman Ortega - DevOps FoundationArman Ortega - DevOps Foundation
Arman Ortega - DevOps Foundation
arman o
 
Arman Ortega - Python | Codeacademy
Arman Ortega - Python | CodeacademyArman Ortega - Python | Codeacademy
Arman Ortega - Python | Codeacademy
arman o
 
GDG Cebu Code Camp Certificate
GDG Cebu Code Camp CertificateGDG Cebu Code Camp Certificate
GDG Cebu Code Camp Certificate
arman 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
 
Fundamentals of Lean Six Sigma
Fundamentals of Lean Six SigmaFundamentals of Lean Six Sigma
Fundamentals of Lean Six Sigma
arman o
 
Arman Ortega - Lean W0
Arman Ortega - Lean W0Arman Ortega - Lean W0
Arman Ortega - Lean W0
arman 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 Training
arman o
 
Arman Ortega - Using Docker
Arman Ortega - Using DockerArman Ortega - Using Docker
Arman Ortega - Using Docker
arman o
 
Arman Ortega - Advanced Javascript
Arman Ortega - Advanced JavascriptArman Ortega - Advanced Javascript
Arman Ortega - Advanced Javascript
arman o
 
Arman Ortega - Javascript using MEAN
Arman Ortega - Javascript using MEANArman Ortega - Javascript using MEAN
Arman Ortega - Javascript using MEAN
arman 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 js
arman o
 
Arman Ortega - PHP5 Tutorial
Arman Ortega - PHP5 TutorialArman Ortega - PHP5 Tutorial
Arman Ortega - PHP5 Tutorial
arman o
 
Arman Ortega - API Connect Overview
Arman Ortega - API Connect OverviewArman Ortega - API Connect Overview
Arman Ortega - API Connect Overview
arman o
 
Arman Ortega - PHP Web App Security
Arman Ortega - PHP Web App SecurityArman Ortega - PHP Web App Security
Arman Ortega - PHP Web App Security
arman o
 
Learning Javascript Design Patterns
Learning Javascript Design PatternsLearning Javascript Design Patterns
Learning Javascript Design Patterns
arman 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 edx
arman o
 
Arman Ortega - Ruby programming
Arman Ortega - Ruby programmingArman Ortega - Ruby programming
Arman Ortega - Ruby programming
arman o
 
Arman Ortega - Javascript tutorials W3Schools
Arman Ortega - Javascript tutorials W3SchoolsArman Ortega - Javascript tutorials W3Schools
Arman Ortega - Javascript tutorials W3Schools
arman 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 Certificate
arman o
 
Arman Ortega - Fundamentals of Javascripts
Arman Ortega - Fundamentals of JavascriptsArman Ortega - Fundamentals of Javascripts
Arman Ortega - Fundamentals of Javascripts
arman o
 
Arman Ortega - DevOps Foundation
Arman Ortega - DevOps FoundationArman Ortega - DevOps Foundation
Arman Ortega - DevOps Foundation
arman o
 
Arman Ortega - Python | Codeacademy
Arman Ortega - Python | CodeacademyArman Ortega - Python | Codeacademy
Arman Ortega - Python | Codeacademy
arman o
 
GDG Cebu Code Camp Certificate
GDG Cebu Code Camp CertificateGDG Cebu Code Camp Certificate
GDG Cebu Code Camp Certificate
arman 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
 
Ad

Recently uploaded (20)

Why Orangescrum Is a Game Changer for Construction Companies in 2025
Why Orangescrum Is a Game Changer for Construction Companies in 2025Why Orangescrum Is a Game Changer for Construction Companies in 2025
Why Orangescrum Is a Game Changer for Construction Companies in 2025
Orangescrum
 
Revolutionizing Residential Wi-Fi PPT.pptx
Revolutionizing Residential Wi-Fi PPT.pptxRevolutionizing Residential Wi-Fi PPT.pptx
Revolutionizing Residential Wi-Fi PPT.pptx
nidhisingh691197
 
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
steaveroggers
 
The Significance of Hardware in Information Systems.pdf
The Significance of Hardware in Information Systems.pdfThe Significance of Hardware in Information Systems.pdf
The Significance of Hardware in Information Systems.pdf
drewplanas10
 
Top 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docxTop 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docx
Portli
 
Kubernetes_101_Zero_to_Platform_Engineer.pptx
Kubernetes_101_Zero_to_Platform_Engineer.pptxKubernetes_101_Zero_to_Platform_Engineer.pptx
Kubernetes_101_Zero_to_Platform_Engineer.pptx
CloudScouts
 
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdfMicrosoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
TechSoup
 
Automation Techniques in RPA - UiPath Certificate
Automation Techniques in RPA - UiPath CertificateAutomation Techniques in RPA - UiPath Certificate
Automation Techniques in RPA - UiPath Certificate
VICTOR MAESTRE RAMIREZ
 
Scaling GraphRAG: Efficient Knowledge Retrieval for Enterprise AI
Scaling GraphRAG:  Efficient Knowledge Retrieval for Enterprise AIScaling GraphRAG:  Efficient Knowledge Retrieval for Enterprise AI
Scaling GraphRAG: Efficient Knowledge Retrieval for Enterprise AI
danshalev
 
Not So Common Memory Leaks in Java Webinar
Not So Common Memory Leaks in Java WebinarNot So Common Memory Leaks in Java Webinar
Not So Common Memory Leaks in Java Webinar
Tier1 app
 
FL Studio Producer Edition Crack 2025 Full Version
FL Studio Producer Edition Crack 2025 Full VersionFL Studio Producer Edition Crack 2025 Full Version
FL Studio Producer Edition Crack 2025 Full Version
tahirabibi60507
 
Explaining GitHub Actions Failures with Large Language Models Challenges, In...
Explaining GitHub Actions Failures with Large Language Models Challenges, In...Explaining GitHub Actions Failures with Large Language Models Challenges, In...
Explaining GitHub Actions Failures with Large Language Models Challenges, In...
ssuserb14185
 
Get & Download Wondershare Filmora Crack Latest [2025]
Get & Download Wondershare Filmora Crack Latest [2025]Get & Download Wondershare Filmora Crack Latest [2025]
Get & Download Wondershare Filmora Crack Latest [2025]
saniaaftab72555
 
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage DashboardsAdobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
BradBedford3
 
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
Egor Kaleynik
 
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Ranjan Baisak
 
Download Wondershare Filmora Crack [2025] With Latest
Download Wondershare Filmora Crack [2025] With LatestDownload Wondershare Filmora Crack [2025] With Latest
Download Wondershare Filmora Crack [2025] With Latest
tahirabibi60507
 
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
F-Secure Freedome VPN 2025 Crack Plus Activation  New VersionF-Secure Freedome VPN 2025 Crack Plus Activation  New Version
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
saimabibi60507
 
Solidworks Crack 2025 latest new + license code
Solidworks Crack 2025 latest new + license codeSolidworks Crack 2025 latest new + license code
Solidworks Crack 2025 latest new + license code
aneelaramzan63
 
Exploring Wayland: A Modern Display Server for the Future
Exploring Wayland: A Modern Display Server for the FutureExploring Wayland: A Modern Display Server for the Future
Exploring Wayland: A Modern Display Server for the Future
ICS
 
Why Orangescrum Is a Game Changer for Construction Companies in 2025
Why Orangescrum Is a Game Changer for Construction Companies in 2025Why Orangescrum Is a Game Changer for Construction Companies in 2025
Why Orangescrum Is a Game Changer for Construction Companies in 2025
Orangescrum
 
Revolutionizing Residential Wi-Fi PPT.pptx
Revolutionizing Residential Wi-Fi PPT.pptxRevolutionizing Residential Wi-Fi PPT.pptx
Revolutionizing Residential Wi-Fi PPT.pptx
nidhisingh691197
 
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
steaveroggers
 
The Significance of Hardware in Information Systems.pdf
The Significance of Hardware in Information Systems.pdfThe Significance of Hardware in Information Systems.pdf
The Significance of Hardware in Information Systems.pdf
drewplanas10
 
Top 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docxTop 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docx
Portli
 
Kubernetes_101_Zero_to_Platform_Engineer.pptx
Kubernetes_101_Zero_to_Platform_Engineer.pptxKubernetes_101_Zero_to_Platform_Engineer.pptx
Kubernetes_101_Zero_to_Platform_Engineer.pptx
CloudScouts
 
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdfMicrosoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
TechSoup
 
Automation Techniques in RPA - UiPath Certificate
Automation Techniques in RPA - UiPath CertificateAutomation Techniques in RPA - UiPath Certificate
Automation Techniques in RPA - UiPath Certificate
VICTOR MAESTRE RAMIREZ
 
Scaling GraphRAG: Efficient Knowledge Retrieval for Enterprise AI
Scaling GraphRAG:  Efficient Knowledge Retrieval for Enterprise AIScaling GraphRAG:  Efficient Knowledge Retrieval for Enterprise AI
Scaling GraphRAG: Efficient Knowledge Retrieval for Enterprise AI
danshalev
 
Not So Common Memory Leaks in Java Webinar
Not So Common Memory Leaks in Java WebinarNot So Common Memory Leaks in Java Webinar
Not So Common Memory Leaks in Java Webinar
Tier1 app
 
FL Studio Producer Edition Crack 2025 Full Version
FL Studio Producer Edition Crack 2025 Full VersionFL Studio Producer Edition Crack 2025 Full Version
FL Studio Producer Edition Crack 2025 Full Version
tahirabibi60507
 
Explaining GitHub Actions Failures with Large Language Models Challenges, In...
Explaining GitHub Actions Failures with Large Language Models Challenges, In...Explaining GitHub Actions Failures with Large Language Models Challenges, In...
Explaining GitHub Actions Failures with Large Language Models Challenges, In...
ssuserb14185
 
Get & Download Wondershare Filmora Crack Latest [2025]
Get & Download Wondershare Filmora Crack Latest [2025]Get & Download Wondershare Filmora Crack Latest [2025]
Get & Download Wondershare Filmora Crack Latest [2025]
saniaaftab72555
 
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage DashboardsAdobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
BradBedford3
 
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
Egor Kaleynik
 
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Ranjan Baisak
 
Download Wondershare Filmora Crack [2025] With Latest
Download Wondershare Filmora Crack [2025] With LatestDownload Wondershare Filmora Crack [2025] With Latest
Download Wondershare Filmora Crack [2025] With Latest
tahirabibi60507
 
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
F-Secure Freedome VPN 2025 Crack Plus Activation  New VersionF-Secure Freedome VPN 2025 Crack Plus Activation  New Version
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
saimabibi60507
 
Solidworks Crack 2025 latest new + license code
Solidworks Crack 2025 latest new + license codeSolidworks Crack 2025 latest new + license code
Solidworks Crack 2025 latest new + license code
aneelaramzan63
 
Exploring Wayland: A Modern Display Server for the Future
Exploring Wayland: A Modern Display Server for the FutureExploring Wayland: A Modern Display Server for the Future
Exploring Wayland: A Modern Display Server for the Future
ICS
 

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