News for hackers. Stuff that matters.
Re:Crazy, Heretical, and Awesome: The Way I Write Rails Apps by epochwolf on Tuesday August 02, 2011 @10:16AM (#2837168)
I use the controller mixin approach. My controller has two public methods: event and save_record. This is how they are used:

    def create
      event(:create, @literature, :notify => current_user.follows_by.users(:literature)) unless params[:skip_event]
      if save_record @literature, &set_creator
        redirect @literature , :notice => "Literature was created."
      else  
        render_form
      end
    end
Here's the code: https://gist.github.com/1120260

There are no comments on this comment yet.