Ruby on Rails

shoulderscobblerInternet και Εφαρμογές Web

2 Φεβ 2013 (πριν από 4 χρόνια και 4 μήνες)

148 εμφανίσεις

Master on Free Software
Ruby on Rails
Asís y David
{asis.garcia, david.barral}@trabesoluciones.com
Master on Free Software

Ruby is a programming language

Java, Python, Perl, C... are also programming
languages

Rails is a MVC web framework written in
Ruby

Struts is a MVC web framework written in
java
Key points
Master on Free Software

Ruby

Characteristics

Installation & tools

Language intro

Ruby on Rails

Characteristics

Installation & tools

Framework intro
Outline
Master on Free Software
Ruby
Master on Free Software
Characteristics

Productivity and fun


We are the masters. They are the slaves.”

Follows the Principle Of Least Surprise

Object Oriented, dynamic, reflective,
interpreted

License compatible with GPL
Master on Free Software
Timeline
Master on Free Software
Setup

Available as package on most systems
$ sudo apt-get install ruby irb rdoc ri rubygems
$ ruby -v

As source code
$ wget ftp://ftp.ruby-lang.org/pub/ruby/stable/ruby-1.8.6.tar.gz
$ tar xvfz ruby-1.8.6.tar.gz
$ cd ruby-1.8.6
$ ./configure
$ make
$ make test
$ make install
Master on Free Software
Tools

irb: interactive Ruby shell

rdoc: documentation

ri: rdoc shell frontend

rake: make like

gems: packaging system
Master on Free Software
A class
Master on Free Software
Everything is an object
Master on Free Software
Even nil is an object
Master on Free Software
Some types
Master on Free Software
Everything returns a value
Master on Free Software
only nil and false are...
false
False?
Master on Free Software
If..else
Master on Free Software
Regexps
Master on Free Software
Loops
Master on Free Software
Blocks (closures)
Master on Free Software
Blocks
Master on Free Software
Modules are objects
(as everything else in ruby)
Group related behavior
Modules
Master on Free Software
Including modules
Master on Free Software
Multiple inheritance...
who cares!?
Modules
Master on Free Software
Duck typing
Master on Free Software
Multiple syntax
Master on Free Software
Method missing
Master on Free Software
Reflection
Master on Free Software
Metaprogramming
Master on Free Software
exceptions
requires
core libraries
include vs. extend
threads
...
All that you can't leave
behind
Master on Free Software
Rails
Master on Free Software
We are so hot!
Master on Free Software
Characteristics

Everything is Ruby

MVC: Model-View-Controller

DRY: Don't Repeat Yourself

CoC: Convention Over Configuration

Opinionated

Rails license
Master on Free Software
Timeline
Master on Free Software
Setup
$ sudo gem install rails
$ sudo apt-get install ruby-dev ruby1.8-dev
$ sudo apt-get install sqlite3 libsqlite3-dev
$ sudo gem install sqlite3-ruby
Master on Free Software
Tools

script/console

script/dbconsole

script/server

script/generate

...

rake tasks
Master on Free Software
Key components
Master on Free Software
Key components

ActiveRecord (Model)

ActionPack

ActionView (View)

ActionController (Controller)
Master on Free Software
Minimal configuration

config/environment.rb

config/database.yml

config/routes.rb
Master on Free Software
Declarative programming
Master on Free Software
Resource oriented

REST

Resources

Representations

HTTP verbs

CRUD

POST – Create

GET – Read

PUT – Update

DELETE – Delete
Master on Free Software
Rest concept
Master on Free Software
Rest in Rails
Master on Free Software
Let's get started
$ rails contacts
Master on Free Software
Links

ruby-lang.org

www.ruby-doc.org

www.ruby-forum.com

rubyforge.org

jobs.rubynow.com

rubyconf2007.confreaks.com

rubyconf2008.confreaks.com

rubyonrails.org

wiki.rubyonrails.org

www.ruby-forum.com

www.workingwithrails.com

agilewebdevelopment.com

www.railslodge.com

weblog.rubyonrails.com

www.loudthinking.com

www.therailsway.com

www.zedshaw.com

4trabes.com

lists.rubyonrails.org/mailman/listinfo/rails

lists.simplelogica.net/mailman/listinfo/ror-es

google.com and ask for Ruby or Rails politely