66. Use default stack?
is it a Is there a Use the default stack
Y N
Y
question of reason not and stop overthinking
taste? to use it? things
N
evaluate your requirements:
templating, JS, ORM,
Performance
N
is it worth it?
Y
is it worth it? Y
Rails 3 custom stack
N
Rails 3 default stack
Wednesday, May 6, 2009
83. DATAMAPPER
does what ActiveRecord does...
but differently
Wednesday, May 6, 2009
84. DATAMAPPER
Copyright - Merb in Action - Manning
db drivers using 1 unified interface
Wednesday, May 6, 2009
85. DATAMAPPER
• procrastination as a value
• Lazy Loading
• Strategic Eager Loader
Wednesday, May 6, 2009
86. DATAMAPPER
students = Student.all
students.each do |student|
student.books.map{|b| b.name}
end
Wednesday, May 6, 2009
87. ACTIVERECORD
students = Student.all
students.each do |student|
student.books.map{|b| b.name}
end
SELECT * FROM quot;studentsquot;
SELECT * FROM quot;booksquot; WHERE
(quot;booksquot;.student_id = 1)
SELECT * FROM quot;booksquot; WHERE
(quot;booksquot;.student_id = 2)
SELECT * FROM quot;booksquot; WHERE
(quot;booksquot;.student_id = 3)
SELECT * FROM quot;booksquot; WHERE
(quot;booksquot;.student_id = X)
Wednesday, May 6, 2009
88. DATAMAPPER
students = Student.all
students.each do |student|
student.books.map{|b| b.name}
end
SELECT quot;idquot;, quot;namequot; FROM quot;studentsquot; ORDER BY quot;idquot;
SELECT quot;idquot;, quot;namequot;, quot;student_idquot; FROM quot;booksquot; WHERE
(quot;student_idquot; IN (1, 2, 3, X)) ORDER BY quot;idquot;
Wednesday, May 6, 2009
91. MULTIPLE REPOS
class Page
include DataMapper::Resource
property :id, Serial
property :name, String
repository(:legacy) do
property :name, String,
:field => quot;titlequot;
end
end
Wednesday, May 6, 2009
92. QUERY::PATH
Find all people
with an address that
has street in the street name
Person.all(quot;addresses.street.likequot; =>
quot;%street%quot; )
SELECT quot;peoplequot;.quot;idquot;, quot;peoplequot;.quot;namequot; FROM quot;peoplequot;
INNER JOIN quot;addressesquot; ON (quot;peoplequot;.quot;idquot; = quot;addressesquot;.quot;person_idquot;)
WHERE (quot;addressesquot;.quot;streetquot; LIKE '%street%')
ORDER BY quot;peoplequot;.quot;idquot;
Wednesday, May 6, 2009
93. ADAPTERS
RDBMS
file system
IMAP
Sales Force
YAML
REST APIs
custom APIs
...
Wednesday, May 6, 2009
94. SEQUEL
• Prepared Statements
• Sharding
• highly customizable SQL work
• high performance
Wednesday, May 6, 2009
95. HIBERNATE
• ActionORM
• JRuby
Wednesday, May 6, 2009
96. NON RDBMS SYSTEMS
• AppEngine::Datastore
• CouchDB with CouchRest or other DSL
• Redis, Tokyo Cabinet etc...
Wednesday, May 6, 2009
97. RAILS EXTREME
only for a few of you
Wednesday, May 6, 2009
99. CREATE YOUR OWN RAILS
• define your own file structure
• define your own router DSL
• define your own ways to deal with requests
Wednesday, May 6, 2009
100. EXTEND
ACTIONCONTROLER
class Presentation < ActionController::Http
def index
self.response_body = quot;Rails3 + MacRubyquot;
end
end
Presentation.action(:index).call
Rack::MockRequest.env_for(quot;/railsconf10quot;)
Wednesday, May 6, 2009
101. EXTEND
ACTIONCONTROLER
def action(&blk)
Class.new(ActionController::Http) do
include ActionController::Renderer
define_method(:xtreme, &blk)
end.action(:xtreme)
end
run action do
render quot;some_templatequot;
end
Wednesday, May 6, 2009