Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save boblmartens/350712 to your computer and use it in GitHub Desktop.
Save boblmartens/350712 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