The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
RejectConf (at Railsconf 2007) and Unit of Work

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Obie Fernandez

Posts: 608
Nickname: obie
Registered: Aug, 2005

Obie Fernandez is a Technologist for ThoughtWorks
RejectConf (at Railsconf 2007) and Unit of Work Posted: May 20, 2007 1:48 PM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Obie Fernandez.
Original Post: RejectConf (at Railsconf 2007) and Unit of Work
Feed Title: Obie On Rails (Has It Been 9 Years Already?)
Feed URL: http://jroller.com/obie/feed/entries/rss
Feed Description: Obie Fernandez talks about life as a technologist, mostly as ramblings about software development and consulting. Nowadays it's pretty much all about Ruby and Ruby on Rails.
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Obie Fernandez
Latest Posts From Obie On Rails (Has It Been 9 Years Already?)

Advertisement

The RejectConf Crowd

Rejectconf did not disappoint, delivering the inside scoop on the really advanced and cutting-edge Rails stuff. I presented my upcoming unit of work concept, which lets you write your controller methods the following way:

class IterationController < ActionController::Base
  include Renaissance::UnitOfWork
  
  def create
    case unit_of_work do
      @iteration = Iteration.new(params[:iteration])
    end
    
    when Success
      redirect_to iteration_path(@iteration)
      
    when ValidationError
      render :action => 'new'      
    end
    
  end
  
  def update
    case unit_of_work do
      @iteration = Iteration.find(params[:id])
      @iteration.update_attributes(params[:iteration])
    end
    
    when Success
      redirect_to iteration_path(@iteration) and return
    
    when StaleObject
      flash[:error] = "Another user beat you to changes"
      @iteration.refresh_and_apply(params[:iteration])
    end
    
    render :action => 'edit'
  end

end

Feedback and comments from folks familiar with the unit of work pattern requested.

Read: RejectConf (at Railsconf 2007) and Unit of Work

Topic: RailsConf 2007 Stuff Previous Topic   Next Topic Topic: Oh, _why!

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use