Return to Snippet

Revision: 1100
at September 9, 2006 09:50 by andyh


Initial Code
def single_record_action
  @record = params[:id] ? CustomRecord.find(params[:id]) : CustomRecord.new
  if request.post?
    @record.attributes = params[:record]
    begin
      @record.save!
      redirect_to :action=>'some_other_action'
    rescue ActiveRecord::RecordInvalid
    end
  end
end

Initial URL

                                

Initial Description

                                

Initial Title
Single Record Save Action Pattern

Initial Tags
rails, ruby

Initial Language
Ruby