Short Version: Think before you code. If you think clearly about your domain problem – the answer is much simpler.
Before DHH’s keynote, rails conf 2007 was announced:
RailsConf 2007 will be done in partnership with O’Reilly & Associates!
may 17th-20th in Portland, OR
DHH talks about his very strong opinions. About bending the outside world to our way, not the other way around.
In “The Real World” You’re weighed down by decades of practices.
The Japanese version of Agile Web Dev sold over 7,000 copies in the first few weeks.
43 Things does 3.5 million rails page views a day now.
h3. Create Read Update Delete (CRUD!)
It is the baseline of most of the work we do in the Rails world.
What they told you about CRUD:
but *THEY WERE WRONG*
h3. “How I learned to stop worrying and love the CRUD”
His old way of doing things
This makes him queasy now
His new ideal:
The problem with the new way is, even though it’s part of the HTTP Spec, it doesn’t translate well to HTML.
ActionController::Routing::Routes.draw do |map|
Rails is all about making a magical world where things just apply – like mapping HTTP verbs not used very much. Even though HTML doesn’t do it, RAILS does (1.2)!
By using a hidden value, @:method => :put@ becomes @input type=”hidden” name=”_method” value=”put”@.
h4. Why Bother?
It’s a lot of work. Why should Rails go through all the trouble of making this work right?
Some of DHH’s code for controllers are a bit of a mess. Sprawling is the right word.
The more decisions you can take out, the more you can get done.
h4. Constraints are liberating
The real power of crud is building our your DSL(Domain Specific Language)
With the new ideas – you can do many to many’s for free. Updates, etc.
Which gets us to “Memberships”
h3. “If you want to indulge in insanity, it should HURT” – DHH.
h3. CRUD is not a goal, it’s an apiration – a design technique.
15 actions in a controller is way too many.
h3. Simply RESTful
by using the extension of the request, you can “force” mime-types. Not just for GETs but POSTs as well
h3. Active Resource