Title / Description
Code class TransactionsController < ApplicationController # GET /transactions def index @transactions = Transaction.find(:all) respond_to do |format| format.html # index.html.erb end end # GET /transactions/1 def show @transaction = Transaction.find(params[:id]) respond_to do |format| format.html # show.html.erb end end # GET /transactions/1/edit def edit @transaction = Transaction.find(params[:id]) end # POST /transactions def create @transaction = Transaction.new(params[:transaction]) respond_to do |format| if @transaction.save flash[:notice] = 'Transaction was successfully created.' format.html { redirect_to(root_url) } else format.html { render :action => "new" } end end end # PUT /transactions/1 def update @transaction = Transaction.find(params[:id]) respond_to do |format| if @transaction.update_attributes(params[:transaction]) flash[:notice] = 'Transaction was successfully updated.' format.html { redirect_to(@transaction) } else format.html { render :action => "edit" } end end end # DELETE /transactions/1 def destroy @transaction = Transaction.find(params[:id]) @transaction.destroy respond_to do |format| format.html { redirect_to(transactions_url) } end end end
Author
Highlight as C C++ CSS Clojure Delphi ERb Groovy (beta) HAML HTML JSON Java JavaScript PHP Plain text Python Ruby SQL XML YAML diff code