Sha256: 602779a8ae30aa013818102ff970a247457235f4a707c7452ebbd6c26dd23fcb
Contents?: true
Size: 1.58 KB
Versions: 2
Compression:
Stored size: 1.58 KB
Contents
class FormsController < ApplicationController def index @posts = Post.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @posts } end end def show @post = Post.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @post } end end def new @post = Post.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @post } end end def edit @post = Post.find(params[:id]) end def create @post = Post.new(params[:post]) respond_to do |format| if @post.save format.html { redirect_to(@post, :notice => 'Post was successfully created.') } format.xml { render :xml => @post, :status => :created, :location => @post } else format.html { render :action => "new" } format.xml { render :xml => @post.errors, :status => :unprocessable_entity } end end end def update @post = Post.find(params[:id]) respond_to do |format| if @post.update_attributes(params[:post]) format.html { redirect_to(@post, :notice => 'Post was successfully updated.') } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @post.errors, :status => :unprocessable_entity } end end end def destroy @post = Post.find(params[:id]) @post.destroy respond_to do |format| format.html { redirect_to(posts_url) } format.xml { head :ok } end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
jqmobile_helpers-0.0.2 | test/dummy/app/controllers/forms_controller.rb |
jqmobile_helpers-0.0.1 | test/dummy/app/controllers/forms_controller.rb |