Sha256: be8b722bbbca44acb075dd4a0cd118fa11c86ecb03f0e159237bf08842fb54ac
Contents?: true
Size: 1.94 KB
Versions: 64
Compression:
Stored size: 1.94 KB
Contents
class DonatesController < ApplicationController load_and_authorize_resource # GET /donates # GET /donates.json def index @donates = Donate.order('id DESC').page(params[:page]) respond_to do |format| format.html # index.html.erb format.json { render :json => @donates } end end # GET /donates/1 # GET /donates/1.json def show respond_to do |format| format.html # show.html.erb format.json { render :json => @donate } end end # GET /donates/new # GET /donates/new.json def new @donate = Donate.new respond_to do |format| format.html # new.html.erb format.json { render :json => @donate } end end # GET /donates/1/edit def edit end # POST /donates # POST /donates.json def create @donate = Donate.new(params[:donate]) respond_to do |format| if @donate.save format.html { redirect_to @donate, :notice => t('controller.successfully_created', :model => t('activerecord.models.donate')) } format.json { render :json => @donate, :status => :created, :location => @donate } else format.html { render :action => "new" } format.json { render :json => @donate.errors, :status => :unprocessable_entity } end end end # PUT /donates/1 # PUT /donates/1.json def update respond_to do |format| if @donate.update_attributes(params[:donate]) format.html { redirect_to @donate, :notice => t('controller.successfully_updated', :model => t('activerecord.models.donate')) } format.json { head :no_content } else format.html { render :action => "edit" } format.json { render :json => @donate.errors, :status => :unprocessable_entity } end end end # DELETE /donates/1 # DELETE /donates/1.json def destroy @donate.destroy respond_to do |format| format.html { redirect_to(donates_url) } format.json { head :no_content } end end end
Version data entries
64 entries across 64 versions & 1 rubygems