Skip to content

Instantly share code, notes, and snippets.

@ezkl ezkl/gist:794003
Created Jan 24, 2011

Embed
What would you like to do?
# routes.rb
resources :clients do
resources :payments
end
# views/clients/index.html.haml
= link_to 'New Payment', new_client_payment_path(client)
# controllers/payments_controller.rb
def new
@payment = Payment.new
respond_to do |format|
format.html # new.html.erb
end
end
def create
@payment = Payment.new(params[:payment])
respond_to do |format|
if @payment.save
format.html { redirect_to(root_path, :notice => 'Payment was successfully created.') }
else
format.html { render :action => "new" }
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.