Sha256: 9d39e0f7fe7634ba4d9f3ec5287fa771c5f0b6b494704da1edb767a2a8fe9486
Contents?: true
Size: 1.89 KB
Versions: 1
Compression:
Stored size: 1.89 KB
Contents
class EntriesController < ApplicationController # GET /entries # GET /entries.xml def index @entries = Entry.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @entries } end end # GET /entries/1 # GET /entries/1.xml def show @entry = Entry.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @entry } end end # GET /entries/new # GET /entries/new.xml def new @entry = Entry.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @entry } end end # GET /entries/1/edit def edit @entry = Entry.find(params[:id]) end # POST /entries # POST /entries.xml def create @entry = Entry.new(params[:entry]) respond_to do |format| if @entry.save format.html { redirect_to(@entry, :notice => 'Entry was successfully created.') } format.xml { render :xml => @entry, :status => :created, :location => @entry } else format.html { render :action => "new" } format.xml { render :xml => @entry.errors, :status => :unprocessable_entity } end end end # PUT /entries/1 # PUT /entries/1.xml def update @entry = Entry.find(params[:id]) respond_to do |format| if @entry.update_attributes(params[:entry]) format.html { redirect_to(@entry, :notice => 'Entry was successfully updated.') } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @entry.errors, :status => :unprocessable_entity } end end end # DELETE /entries/1 # DELETE /entries/1.xml def destroy @entry = Entry.find(params[:id]) @entry.destroy respond_to do |format| format.html { redirect_to(entries_url) } format.xml { head :ok } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
test_app_as_gem-0.01 | app/controllers/entries_controller.rb |