0
RUBY ON RAILSAN INTRODUCTION
ABOUT ME• Constantine   Nicolaou• Software   Developer• Works   for Mekentosj B.V. (UK)• twitter: @cnicolaou• github: cnic...
ABOUT RUBY•   Creator: Yukihiro Matsumoto (Matz)•   Released in 1995•   Open Source•   Remained relatively underused outsi...
ABOUT RAILS                          (ELEVATOR PITCH)•   Open Source web framework created by David Heinemeier    Hansson ...
BEAUTIFUL SYNTAX? REALLY?      RAILS CONTROLLER CLASS
MORE ON RUBY• Everything     is an Object• Dynamic     (no type declarations)• No     brackets for simple method calls• La...
RUBY DATA STRUCTURESdata type    literal               description integer        1 range        1..5 string      ‘rails’ ...
CODE EXAMPLES         simple loop in Ruby         simple loop in PHP                  loop in Java         simplest loop s...
SO, WHY RAILS?•   Easy, fast and fun way to develop web applications•   MVC (Model-View-Controller) architectural pattern•...
ALSO, BIG NAMESRUBYONRAILS.ORG/APPLICATIONS
RAILS MVCHOW DOES IT WORK?
ACTIVERECORD(OBJECT-RELATION MAPPING (ORM) PUT ON RAILS)• ORM  pattern: An object that wraps a row in a database table... ...
SHOW US SOME CODE  ...switching to terminal
ACTIVERECORD - 2• Associations            (has_one, has_many, belongs_to, has_and_belongs_to_many)• Validations: rules    ...
ACTIONVIEW• Embedding   Ruby in HTML (ERb template engine) <h1>People</h1> <ul>  <% @people.each do |person| -%>    <li><%...
BACK TO PAPERSPAPERS: SEARCH, READ, CITE, SHARE
AVOIDING THIS
LIVFE IS PAPERSCOLLABORATIVE SOLUTION        Papers Livfe        Your Papers life, live.
PAPERS LIVFE• Organise   and share papers using Livfe Collections• Micro   comments, reviews and ratings on papers• Send  ...
PAPERS LIVFE                       (UNDER THE HOOD)• Based   on Ruby on Rails• Private APIs   to Papers apps (Mac, iOS)• D...
EXAMPLE OF AN APIConsuming the API (with cURL)curl -X GET -H "Accept: text/xml" http://username:password@livfe.net/api/v1....
ONE MORE THING
“Your time is limited, so don’t waste it living someoneelse’s life… Stay hungry. Stay foolish.”Steve Jobs, Stanford 2005
THANK YOUQUESTIONS?
RESOURCES   railscasts.com    tryruby.orgruby.railstutorial.orgrailsforzombies.org   peepcode.com
Upcoming SlideShare
Loading in...5
×

TechNinjas Ep.1: Intro to Ruby On Rails

649

Published on

On October 6 2011, Seeqnce hosted a full house of developers, entrepreneurs and startup fans to watch Costa Nicolaou (@cnicolaou) give a talk about Ruby on Rails.

As a master of Rails (we call his kind Ninjas), Costa took the audience through the MVC fundamentals of the platform, dived straight into code examples and gave real-world examples of why RoR is such an appealing framework to adopt.

Make sure you check out the full video at: http://bit.ly/p8pAp0

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
649
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
1
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "TechNinjas Ep.1: Intro to Ruby On Rails"

  1. 1. RUBY ON RAILSAN INTRODUCTION
  2. 2. ABOUT ME• Constantine Nicolaou• Software Developer• Works for Mekentosj B.V. (UK)• twitter: @cnicolaou• github: cnicolaou
  3. 3. ABOUT RUBY• Creator: Yukihiro Matsumoto (Matz)• Released in 1995• Open Source• Remained relatively underused outside of Japan until Rails brought it to prominence (2003)• Cross platform (OS X, Linux and Windows)• RubyGems: package manager for Ruby (gem install rails)
  4. 4. ABOUT RAILS (ELEVATOR PITCH)• Open Source web framework created by David Heinemeier Hansson (DHH) in 2003 (get it from github.com/rails/rails)• Developed with happiness and productivity of developers in mind• Beautiful and readable syntax (thanks to Ruby)• Favours convention over configuration (plural tables names, singular model names)• Don’t Repeat Yourself (DRY)
  5. 5. BEAUTIFUL SYNTAX? REALLY? RAILS CONTROLLER CLASS
  6. 6. MORE ON RUBY• Everything is an Object• Dynamic (no type declarations)• No brackets for simple method calls• Last statement of a method is automatically returned (18:09) costa:~/dev/apps$ irb ree-1.8.7-2011.03 :001 > def add(number1, number2); number1 +number2; end; ree-1.8.7-2011.03 :002 > add(1, 5) => 6
  7. 7. RUBY DATA STRUCTURESdata type literal description integer 1 range 1..5 string ‘rails’ float 1.0 floating-point representation symbol :rails string for identifying purpose array [‘a’, ‘b’] list of objects, fixed order hash {:a=>1} Collection of key, value pairs
  8. 8. CODE EXAMPLES simple loop in Ruby simple loop in PHP loop in Java simplest loop so far?
  9. 9. SO, WHY RAILS?• Easy, fast and fun way to develop web applications• MVC (Model-View-Controller) architectural pattern• Predefined application structure• Rails was built with testing support in mind (test folder exists by default in the application structure)• Different environments within the same application (database.yml)• Active community and lots of resources to learn from
  10. 10. ALSO, BIG NAMESRUBYONRAILS.ORG/APPLICATIONS
  11. 11. RAILS MVCHOW DOES IT WORK?
  12. 12. ACTIVERECORD(OBJECT-RELATION MAPPING (ORM) PUT ON RAILS)• ORM pattern: An object that wraps a row in a database table... and adds domain logic on that data (Martin Fowler)• Ruby classes that are located under app/models• One database table maps to one Ruby class• Attributes are columns• Associations between objects (A user has many blog posts)
  13. 13. SHOW US SOME CODE ...switching to terminal
  14. 14. ACTIVERECORD - 2• Associations (has_one, has_many, belongs_to, has_and_belongs_to_many)• Validations: rules in models on objects validates_presence_of :name• Callbacks: before_save, before_update, after_create
  15. 15. ACTIONVIEW• Embedding Ruby in HTML (ERb template engine) <h1>People</h1> <ul> <% @people.each do |person| -%> <li><%= person.first_name %></li> <% end -%> </ul>• Forms: Form Helpers / to HTML / to params / to ActiveRecord then validate attributes and save
  16. 16. BACK TO PAPERSPAPERS: SEARCH, READ, CITE, SHARE
  17. 17. AVOIDING THIS
  18. 18. LIVFE IS PAPERSCOLLABORATIVE SOLUTION Papers Livfe Your Papers life, live.
  19. 19. PAPERS LIVFE• Organise and share papers using Livfe Collections• Micro comments, reviews and ratings on papers• Send and receive papers recommendations• Adds collaboration to existing workflow
  20. 20. PAPERS LIVFE (UNDER THE HOOD)• Based on Ruby on Rails• Private APIs to Papers apps (Mac, iOS)• Different representational formats based on request types• Recommend papers to users based on criteria (for example: keywords or field of interest or job title)
  21. 21. EXAMPLE OF AN APIConsuming the API (with cURL)curl -X GET -H "Accept: text/xml" http://username:password@livfe.net/api/v1.2/collections/
  22. 22. ONE MORE THING
  23. 23. “Your time is limited, so don’t waste it living someoneelse’s life… Stay hungry. Stay foolish.”Steve Jobs, Stanford 2005
  24. 24. THANK YOUQUESTIONS?
  25. 25. RESOURCES railscasts.com tryruby.orgruby.railstutorial.orgrailsforzombies.org peepcode.com
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×