Upcoming SlideShare
×

# OSOM - Ruby on Rails

526 views

Published on

OSOM - Open Source Open Mind - V3.0 Back to the roots - Cluj Napoca 2012
www.osom.ro

Published in: Technology
0 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

• Be the first to like this

Views
Total views
526
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
3
0
Likes
0
Embeds 0
No embeds

No notes for slide

### OSOM - Ruby on Rails

1. 1. Ruby on Rails
2. 2. Mihai Frisan● Programator● Indragostit de Ruby on Rails din 2006● Sustinator al software-ului open sourceBlog: mihai.frisan.roTwitter: @mihaifrisan
3. 3. Yukihiro Matz Matsumoto Creator Ruby
4. 4. Ruby● limbaj de programare orientat obiect● dinamic● focusat pe simplitate si productivitate● sintaxa eleganta si naturala
5. 5. Totul in Ruby este obiect # Tipareste "MAJUSCULE" puts "majuscule".upcase # Tipareste valoarea absoluta a lui -5 puts -5.abs # Tipareste de 5 ori "Ruby Rocks!" 5.times do puts "Ruby Rocks!" End # Tipareste numerele de la 1 la 100 1.upto(100) { |i| puts i }
6. 6. Ruby este un limbaj de programare dinamicdef len(list) public static int len(List list) x=0 { list.each do |element| int x = 0; x += 1 Iterator listIterator = end list.iterator();end while(listIterator.hasNext()){ x += 1; } }
7. 7. Ruby este focusat pe simplitate si productivitateclass Circle Class Circle attr_accessor :center, :radius private Coordinate center, float radius;end public void setCenter(Coordinate center){ this.center = center; } public Coordinate getCenter(){ return center; } public void setRadius(float radius){ this.radius = radius; } public Coordinate getRadius(){ return radius; } }
8. 8. Ruby on Rails
9. 9. David Heinemeier Hansson Creator Ruby on Rails
10. 10. Rails● framework destinat dezvoltarii de aplicatii Web● full-stack framework● MVC pattern● Convention over Configuration
11. 11. Arhitectura Rails
12. 12. Models
13. 13. ActiveRecord● Object Relation Mapping (ORM)● Mapeaza tabele la clase si randurile la obiecte● Database Agnostic
14. 14. ActiveRecordCREATE TABLE entries ( id int(11) NOT NULL auto_increment, name varchar(255), comments varchar(255), PRIMARY KEY (id));class Entry < ActiveRecord::Base # nothing here!endentry = Entry.newentry.name = "John"entry.comments = "What a great Web site!"entry.saveentry = Entry.find(1)puts entry.name # output: "John"
15. 15. ActiveRecordclass Entry < ActiveRecord::Base belongs_to :account has_many :comments validates_presence_of :name acts_as_taggableendentry = Entry.newentry.name = "John"entry.comments << Comment.new("What a great Web site!")entry.saveEntry = Entry.find_by_name(“John”)
16. 16. Rails programmers like fat Models
17. 17. Controler
18. 18. ActionController● Managementul request-urilor● Mapeza actiunile la metode● Separa logica de prezentare● Implementeaza resursele RESTful
19. 19. ActionController
20. 20. View
21. 21. ActionView● Prezinta utilizatorului datele● Foloseste template-uri● Mecanism de caching
22. 22. ActionView
23. 23. Proiecte dezvoltate in Rails
24. 24. Companii care folosesc Rails
25. 25. De ce as folosi Rails? ● Convention over Configuration ● Data mapping ● AJAX ● Testing Framework ● Agile Development ● Numar impresionant de librarii