Skip to content

Instantly share code, notes, and snippets.

@durran
Created March 31, 2010 18:36
Show Gist options
  • Save durran/350697 to your computer and use it in GitHub Desktop.
Save durran/350697 to your computer and use it in GitHub Desktop.
class InterventionsController < ApplicationController
inherit_resources
actions :create, :update, :edit, :new
nested_belongs_to :patient, :drug_therapy_problem
create! do |success, failure|
success.html do
@intervention.activate!("Manual communication")
end
failure.html { render :action => 'new', :status => :unprocessable_entity }
end
protected
def build_resource
@intervention ||= end_of_association_chain.build(params[:intervention] || {})
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment