Skip to content

Instantly share code, notes, and snippets.

@pdtpatrick
Created September 10, 2012 18:28
Show Gist options
  • Save pdtpatrick/3692751 to your computer and use it in GitHub Desktop.
Save pdtpatrick/3692751 to your computer and use it in GitHub Desktop.
controller_sharing
class PoliciesController < ApplicationController
def new
@policy = Policy.new
end
def create
@policy = Policy.new(params[:policy])
# save policy
if @policy.save
flash[:notice_success] = "Form sent."
redirect_to(:action => 'new')
else
#if failed do
# render('new')
flash[:notice_fail] = "Please fix errors"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment