Rails and Merb

1,376 views
1,248 views

Published on

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

No Downloads
Views
Total views
1,376
On SlideShare
0
From Embeds
0
Number of Embeds
12
Actions
Shares
0
Downloads
0
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide






































































































  • Rails and Merb

    1. 1. “Web development that doesn’t hurt” Thursday, February 5, 2009
    2. 2. “Faster, Lighter, More Agile” Thursday, February 5, 2009
    3. 3. Merb == Rails Merb != Rails Rails << Merb Thursday, February 5, 2009
    4. 4. Merb == Rails Thursday, February 5, 2009
    5. 5. “Rails is a Model View Controller web framework written in Ruby.” Thursday, February 5, 2009
    6. 6. “Merb is a Model View Controller web framework written in Ruby.” Thursday, February 5, 2009
    7. 7. merb-gen app blog rails blog Thursday, February 5, 2009
    8. 8. Merb != Rails Thursday, February 5, 2009
    9. 9. Merb = Mongrel + erb Thursday, February 5, 2009
    10. 10. Hey there folks- I'm happy to announce the first useable release of my new pocket- Merb is a mongrel handler with framework Merb. built in controller and view templating with erb. It has a nice routing system similar to rails but much simpler. It uses some of the code from the camping handler and the rails handler and then some of its own secret sauce to form imho a nice fast little framework. -- Ezra Zygmuntowicz, 10-2006 Thursday, February 5, 2009
    11. 11. Merb -= Mongrel Merb -= erb Thursday, February 5, 2009
    12. 12. Enter Rack “Rack provides an minimal interface between webservers supporting Ruby and Ruby frameworks.” Thursday, February 5, 2009
    13. 13. Camping Passenger Ramaze Mongrel Rack Merb Thin Sinatra WEBrick ... ... Handlers Adapters Thursday, February 5, 2009
    14. 14. Rails Merb ORM ActiveRecord Pick one! Test framework Test::Unit Don’t care! Template language erb Your choice! JS framework Prototype Whatever! Thursday, February 5, 2009
    15. 15. rails The full monty under your fingertips with a single command. Thursday, February 5, 2009
    16. 16. actionmailer actionpack activerecord activeresource activesupport rails Thursday, February 5, 2009
    17. 17. merb Small core, build your personal stack with available gems. Thursday, February 5, 2009
    18. 18. merb-helpers merb-cache merb-mailer merb-assets merb-slices merb-action-args merb-core merb-param-protection merb-exceptions merb-auth-core merb-auth-more merb-auth-slice-password Thursday, February 5, 2009
    19. 19. “the framework” merb-helpers merb-cache - Router - Controller merb-mailer merb-assets - Logger - Provide hooks for plugins merb-slices merb-action-args merb-core merb-param-protection merb-exceptions merb-auth-core merb-auth-more merb-auth-slice-password Thursday, February 5, 2009
    20. 20. merb-helpers merb-cache merb-mailer merb-assets merb-slices merb-action-args merb-core merb-param-protection merb-exceptions merb-auth-core merb-auth-more merb-auth-slice-password Thursday, February 5, 2009
    21. 21. ActionController::Base ActionMailer::Base Thursday, February 5, 2009
    22. 22. Merb::AbstractController Merb::Controller Merb::MailController Thursday, February 5, 2009
    23. 23. Plugins Thursday, February 5, 2009
    24. 24. Gems Thursday, February 5, 2009
    25. 25. Rails << Merb Thursday, February 5, 2009
    26. 26. rails-core Thursday, February 5, 2009
    27. 27. Rails 3 ORM Pick one! Test framework Don’t care! Template language Your choice! JS framework Whatever! Thursday, February 5, 2009
    28. 28. Rails 3 ORM Pick one! Test framework Don’t care! Template language Your choice! JS framework Whatever! Thursday, February 5, 2009
    29. 29. Rails 3 ORM Pick one! Agnosticism! Test framework Don’t care! Template language Your choice! JS framework Whatever! Thursday, February 5, 2009
    30. 30. Public API With tests to ensure it doesn’t magically change overtime! Thursday, February 5, 2009
    31. 31. DataMapper Thursday, February 5, 2009
    32. 32. SELECT * FROM persons WHERE country = 'NL' Thursday, February 5, 2009
    33. 33. SELECT * FROM persons WHERE country = 'NL' AR: Person.find(:all, :conditions => [quot;country = ?quot;, quot;NLquot;]) Thursday, February 5, 2009
    34. 34. SELECT * FROM persons WHERE country = 'NL' AR: Person.find(:all, :conditions => [quot;country = ?quot;, quot;NLquot;]) DM: Person.all(:country => quot;NLquot;) Thursday, February 5, 2009
    35. 35. SELECT * FROM persons WHERE age BETWEEN 18 AND 21 ORDER BY AGE DESC Thursday, February 5, 2009
    36. 36. SELECT * FROM persons WHERE age BETWEEN 18 AND 21 ORDER BY AGE DESC AR: Person.find(:all, :conditions => [quot;age BETWEEN ? AND ?quot;, 18, 21], :order => quot;age DESCquot;) # => :( SQL fragments! Thursday, February 5, 2009
    37. 37. SELECT * FROM persons WHERE age BETWEEN 18 AND 21 ORDER BY AGE DESC AR: Person.find(:all, :conditions => [quot;age BETWEEN ? AND ?quot;, 18, 21], :order => quot;age DESCquot;) # => :( SQL fragments! DM: Person.all(:age.gt => 18, :age.lt => 21, :order => [:age.desc]) Thursday, February 5, 2009
    38. 38. Nice: “strategic eager loading” 100 zoos; 250 exhibits zoos = Zoo.all zoos.each do |zoo| zoo.exhibits.each do |exhibit| puts quot;Zoo: #{zoo.name}, Exhibit: #{exhibit.name}quot; end end Queries ActiveRecord DataMapper Thursday, February 5, 2009
    39. 39. Nice: “strategic eager loading” 100 zoos; 250 exhibits zoos = Zoo.all zoos.each do |zoo| zoo.exhibits.each do |exhibit| puts quot;Zoo: #{zoo.name}, Exhibit: #{exhibit.name}quot; end end Queries 101 ActiveRecord DataMapper Thursday, February 5, 2009
    40. 40. Nice: “strategic eager loading” 100 zoos; 250 exhibits zoos = Zoo.all zoos.each do |zoo| zoo.exhibits.each do |exhibit| puts quot;Zoo: #{zoo.name}, Exhibit: #{exhibit.name}quot; end end Queries 101 ActiveRecord 2 DataMapper Thursday, February 5, 2009
    41. 41. Associations class Zoo include DataMapper::Resource class Zoo < ActiveRecord::Base belongs_to :owner belongs_to :owner has 1, :cafetaria has_one :cafetaria has n, :animals has_many :animals has n, :donors, :through => Resource has_and_belongs_to_many :donors has n, :zookeepers, :through => :agencies has_many :zookeepers, :through => :agencies end end Thursday, February 5, 2009

    ×