Introduction to

Ruby On Rails


by :
Sameer Rahmani (@lxsameer)
Behnam  Khan Beigi (@yottanami)

from:
 




Who are we ?



We . . .

  • have 9 years experience as senior developer in Yellowen
  • have over thousands of contributes to FOSS world
  • are official GNU project developer
  • are members of Debian python team
 
Expert in:
PHP, Python, Ruby, Javascript,
 C/C++,Perl, Clojure, Scala

Many successful projects

Check out our github page


What is




Ruby On Rails ?







 + Web framework =


Ruby on Rails is a web framework  that's
optimized for programmer happiness
 sustainable productivity




It lets you write beautiful code by favoring
 convention over configuration



Why Ruby ?


Ruby brings large increase in productivity


with 


Non traditional programming

 style

Ruby is very easy to


Learn 
&
Develop


Ruby is very powerful

in

Meta Programming 

Every thing is an object


string = String.new

2.times do 
    puts "Hello world"
end # Hello world# Hello world

1.upto(100) { |i| puts i }# 1# 2...# 100
some_list = [String, "some string", Integer]

Everything is an Object




class Class
  def some_method
    puts "I'm in 'Class' class"
  end
end

class Test
end

Test.some_method
# I'm in 'Class' class 

Blocks



people.each do |person| if person.sick? doctor.visit person else  person.jumps_around end end
hello = Proc.new do |string| puts "Hello #{string.upcase}"end
hello.call 'sameer'# Hello sameer

Monky Patching

 ( Open Classes )



class String
  def say_hello
    puts "Hello #{self.to_s}"
  end
end

"sameer".say_hello
# Hello sameer 




And lots of awesome features




Why Rails ?

Why Rails ?



  • MVC design
  • It follows a RESTful, resource-oriented approach
  • Strong dependency management, thanks to bundler
  • It supports wide range of databases
    (SQLite, Postgresql, MySQL, MariaDB, MongoDB, etc)
  • Rails Convention* allows rapid development

Why Rails ?



  • Very active community
  • It's all about testing and unit tests.
     (lots of unit test framework even for javascript)
  • Very unique assets management system.
  • Integrated with CoffeeScript and Sass lang
  • Autoloading dependencies (using convention)
  • Multi-Stage development environments

Why Rails ?


  • Rails apps can be easily deployed to clouds
     (like: Heraku, Openshift, Amazon S3,
     or private servers or clouds)
  • Same structure for each application allows
     easy debugging and rapid development
  • Database migrations
  • Thanks to Monkey Patching, extending
     Rails would be very easy

  • There are lots of useful gems around.

Trusted by giants



  • Scribd
  • YellowPages
  • Basecamp
  • Shopify
  • Urban Dictionary
  • SlideShare
  • GitHub

Trusted by giants



  • Hulu
  • Groupon
  • LivingSocial
  • Twitter (old version)
  • SoundCloud
  • ZenDesk
  • Rubygems (of course)

What is Ruby Gem?




  • Gems are ruby code packages
  • Install gems on your system using `gem` command
  • Rails framework is a gem
  • You can have multiple version of a same gem

What is Bundler ?



  • Bundler is a dependency management
     system for ruby
  • Bundler uses ruby gems
  • Rails uses bundler to handle dependencies
  • Bundler can fetch gems from wide range
     of locations with different protocols




It's show time

Ruby installation




  • Install Ruby using your package manager
  • Install Ruby using RVM
  • Install Ruby using rbenv ( my favorite )
  • Install Ruby using chrb 


Let's review rbenv.

How to Install Rails ?




It's very easy. Just do it like:
$ gem install rails 



Let's have fun with

 Ruby on Rails
for couple of minutes



How can I learn more ?

Ruby




Rails




Meet us


Web:
yottanami.com


We always hang out at
#5hit channel on Freenode IRC 
server

Not satisfied ?


Ask your questions on IranOnRails

or on Twitter:
  @lxsameer
@yottanami

or by Email:
lxsameer@gnu.org
yottanami@gnu.org





Take care guys

Hope to see you again

Introduction to Ruby ON Rails

By Sameer Rahmani

Introduction to Ruby ON Rails

A short presentation on RoR

  • 2,322