the rich get richer rails 3
play

The Rich Get Richer: RAILS 3 PRESENTED BY OBIE FERNANDEZ Sunday, - PowerPoint PPT Presentation

HASHROCKET EXPERTLY CRAFTED WEB The Rich Get Richer: RAILS 3 PRESENTED BY OBIE FERNANDEZ Sunday, December 5, 2010 About 20k USD Sunday, December 5, 2010 About 45k USD Sunday, December 5, 2010 About 200k USD Sunday, December 5, 2010 a


  1. HASHROCKET EXPERTLY CRAFTED WEB The Rich Get Richer: RAILS 3 PRESENTED BY OBIE FERNANDEZ Sunday, December 5, 2010

  2. About 20k USD Sunday, December 5, 2010

  3. About 45k USD Sunday, December 5, 2010

  4. About 200k USD Sunday, December 5, 2010

  5. “a few million dollars” Sunday, December 5, 2010

  6. Sunday, December 5, 2010

  7. HASHROCKET EXPERTLY CRAFTED WEB OMG RAILS 3 ROCKS SO MUCH MORE THAN RAILS 2!!! PRESENTED BY OBIE FERNANDEZ Sunday, December 5, 2010

  8. How is Rails 3 Richer? mainstream adoption maturity performance open-source mindshare CAUTION: JUST A METAPHOR Sunday, December 5, 2010

  9. Sunday, December 5, 2010

  10. The Rich Get Richer: RAILS 3 OBIE FERNANDEZ Presentation Overview • History and Context • What’s new • ActiveRecord Performance • Impact on Application Development Sunday, December 5, 2010

  11. Sunday, December 5, 2010

  12. Ezra Zygmuntovich Sunday, December 5, 2010

  13. merb [...] clocks in at 17,291 [loc]. Rails clocks in at 47,195. As you can see, it’s a tie. Sunday, December 5, 2010

  14. Yehuda Katz Sunday, December 5, 2010

  15. December 23, 2008 Sunday, December 5, 2010

  16. David Heinemeir Hansson Sunday, December 5, 2010

  17. Tom Mornini Photo Credit: Sebastian Delmont Sunday, December 5, 2010

  18. Tom Mornini Photo Credit: Sebastian Delmont Sunday, December 5, 2010

  19. Sunday, December 5, 2010

  20. Sunday, December 5, 2010

  21. Q: How do you prevent bloating? Ryan Sanchez's "Violet Beauregarde" ("Charlie and the Chocolate Factory") Photo by Tera Heater/ MTV News Sunday, December 5, 2010

  22. A: Decoupling http://yestheykeepmebusy.blogspot.com/2009/11/willy-wonka- halloween.html Sunday, December 5, 2010

  23. A: Modularity http://superpunch.blogspot.com/2009/10/lego-violet-beauregarde-and- more.html Sunday, December 5, 2010

  24. require 'active_support/concern' require 'active_support/ordered_options' require 'active_support/core_ext/kernel/singleton_class' require 'active_support/core_ext/module/delegation' module ActiveSupport # Configurable provides a <tt>config</tt> method to store and retrieve # configuration options as an <tt>OrderedHash</tt>. module Configurable extend ActiveSupport::Concern class Configuration < ActiveSupport::InheritableOptions def compile_methods! self.class.compile_methods!(keys.reject {|key| respond_to?(key)}) end # compiles reader methods so we don't have to go through method_missing def self.compile_methods!(keys) keys.each do |key| class_eval <<-RUBY, __FILE__, __LINE__ + 1 def #{key}; _get(#{key.inspect}); end RUBY end end end ... Sunday, December 5, 2010

  25. Sunday, December 5, 2010

  26. Rails 3.0 August 29, 2010 SA Sunday, December 5, 2010

  27. The Rich Get Richer: RAILS 3 OBIE FERNANDEZ Notable Plugin Changes • Formtastic 1.1 (made compatible) • InheritedResources 1.1 (rewritten) • Devise (significant upgrades) • RSpec 2 (rewritten) • EmailSpec 1.0 (rewritten) • MetaSearch (instead of Searchlogic) Sunday, December 5, 2010

  28. Sunday, December 5, 2010

  29. Sunday, December 5, 2010

  30. What’s new in Rails 3? Sunday, December 5, 2010

  31. Sunday, December 5, 2010

  32. Sunday, December 5, 2010

  33. config/routes.rb Sunday, December 5, 2010

  34. # This file is used by Rack-based servers to start the application. require ::File.expand_path('../config/environment', __FILE__) run Example::Application config.ru Sunday, December 5, 2010

  35. Rack::Cache ActionDispatch::Static Rack::Lock Rack::Runtime Rails::Rack::Logger ActionDispatch::ShowExceptions ActionDispatch::RemoteIp Rack::Sendfile ActionDispatch::Callbacks ActionDispatch::Cookies ActionDispatch::Flash ActionDispatch::ParamsParser Rack::MethodOverride ActionDispatch::Head Rack::ConditionalGet Rack::ETag ActionDispatch::BestStandardsSupport Rails 3 Middleware “Stack” Sunday, December 5, 2010

  36. Sunday, December 5, 2010

  37. Sunday, December 5, 2010

  38. Sunday, December 5, 2010

  39. gem "rails", "3.0.1" gem 'jquery-rails' gem "mysql" gem "haml", "3.0.18" gem "decent_exposure", "1.0.0.rc1" gem "devise", "1.1.3" gem "chronic", "0.2.3" gem "seed-fu", "1.2.3", :git => "git://github.com/supaspoida/seed-fu.git" gem "block_helpers", "0.3.3" gem "will_paginate", "3.0.pre2" gem "geokit", "1.5.0" group :test do gem "capybara", "0.3.9" gem 'database_cleaner', '0.5.0' gem 'launchy', '0.3.7' gem "rspec-rails", "2.0.1" gem "mocha", "0.9.9" gem "shoulda", "2.11.3" gem "selenium-webdriver" gem "timecop", "0.3.5" gem "watchr" gem "specjour", "0.3.1" Gemfile gem "email_spec", "1.0.0" end Sunday, December 5, 2010

  40. $ bundle Fetching source index for http://rubygems.org Using rake (0.8.7) Using abstract (1.0.0) Using activesupport (3.0.1) Using builder (2.1.2) Using i18n (0.4.2) Using activemodel (3.0.1) ... Your bundle is complete! It was installed into /Users/obie/.rvm/gems/ruby-1.9.2- p0@example-application Sunday, December 5, 2010

  41. Sunday, December 5, 2010

  42. Arel by Nick Kallen Sunday, December 5, 2010

  43. Sunday, December 5, 2010

  44. “closure under composition” Sunday, December 5, 2010

  45. User.find :conditions => { :name => "obie" } # in Rails 3 becomes User.where(:name => "obie") Sunday, December 5, 2010

  46. >> u = User.where(first_name: "Pascale"); u.to_sql => "SELECT `users`.* FROM `users` WHERE (`users`.`first_name` = 'Pascale') >> u.where(age: 21).to_sql => "SELECT `users`.* FROM `users` WHERE (`users`.`first_name` = 'Pascale') AND (`users`.`age` = 21)" >> u.order(:name).limit(20).to_sql => "SELECT `users`.* FROM `users` WHERE (`users`.`first_name` = 'Pascale') ORDER BY name LIMIT 20" Sunday, December 5, 2010

  47. class Invitation < ActiveRecord::Base default_scope order("created_at DESC") scope :accepted, where("accepted_at is NOT NULL") scope :pending, where(accepted_at: nil) ... end Scopes Sunday, December 5, 2010

  48. All of my open-sourced projects share two attributes. First, the source code is extremely stylized and meant to be /read/ more than /used/. They are literary arguments in code much more than a useful piece of infrastructure. If you read the source-code to Arel you will see a highly a fg ected "combinator" and "interpreter" style of coding. Nick Kallen Sunday, December 5, 2010

  49. “Holy shit, Rails 3 is slow!” Sunday, December 5, 2010

  50. #5098 Sunday, December 5, 2010

  51. joins = [{:dim_locations=>[:dim_zip, {:dim_city=> {:dim_state=>:dim_country}}]}, :dim_ages, :dim_car_makes, :dim_educations, :dim_employments, :dim_foods, :dim_genders, :dim_get_aways, :dim_home_ownerships, :dim_incomes, :dim_marital_statuses, :dim_teams] conditions = ["(dim_zips.zip_code = ? OR dim_zips.zip_code IS NULL) AND (dim_cities.city = ? OR dim_cities.city IS NULL) AND (dim_states.state_code = ? OR dim_states.state_code IS NULL) AND (dim_states.state = ? OR dim_states.state IS NULL) AND (dim_countries.country_code = ? OR dim_countries.country_code IS NULL) AND (dim_countries.country = ? OR dim_countries.country IS NULL) AND (dim_ages.age = ? OR dim_ages.age IS NULL) AND (dim_car_makes.car_make IN (?) OR dim_car_makes.car_make IS NULL) AND (dim_educations.education = ? OR dim_educations.education IS NULL) AND (dim_employments.employment = ? OR dim_employments.employment IS NULL) AND (dim_foods.food IN (?) OR dim_foods.food IS NULL) AND (dim_genders.gender = ? OR dim_genders.gender IS NULL) AND (dim_get_aways.get_away IN (?) OR dim_get_aways.get_away IS NULL) AND (dim_home_ownerships.home_ownership = ? OR dim_home_ownerships.home_ownership IS NULL) AND (dim_incomes.income = ? OR dim_incomes.income IS NULL) AND (dim_marital_statuses.marital_status = ? OR dim_marital_statuses.marital_status IS NULL) AND (dim_teams.team IN (?) OR dim_teams.team IS NULL)", "98104", "Seattle", "WA", "Washington", "US", "United States of America", "18-34", ["Ashton Martin"], "Bachelors", "Full Time", ["Brazilian"], "Male", ["France"], "Rent", "Less than 30k", "Married", ["Arizona Cardinals", "Boston Bruins"]] Benchmark.measure do Koupon.includes(joins).where(conditions).each end => 127.930000 0.390000 128.320000 (129.897278) Sunday, December 5, 2010

  52. Sunday, December 5, 2010

  53. O(n^2) vs O(n) Sunday, December 5, 2010

  54. routing Sunday, December 5, 2010

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend