/ Published in: Ruby

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
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
Comments
