Sha256: 7366e3c9c6fc559860b431fea56c802ce3c59188e7b6aa331fd0c31567edb531
Contents?: true
Size: 1.87 KB
Versions: 7
Compression:
Stored size: 1.87 KB
Contents
class ForumsController < ApplicationController # GET /forums # GET /forums.xml def index @forums = Forum.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @forums } end end # GET /forums/1 # GET /forums/1.xml def show @forum = Forum.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @forum } end end # GET /forums/new # GET /forums/new.xml def new @forum = Forum.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @forum } end end # GET /forums/1/edit def edit @forum = Forum.find(params[:id]) end # POST /forums # POST /forums.xml def create @forum = Forum.new(params[:forum]) respond_to do |format| if @forum.save format.html { redirect_to(@forum, :notice => 'Forum was successfully created.') } format.xml { render :xml => @forum, :status => :created, :location => @forum } else format.html { render :action => "new" } format.xml { render :xml => @forum.errors, :status => :unprocessable_entity } end end end # PUT /forums/1 # PUT /forums/1.xml def update @forum = Forum.find(params[:id]) respond_to do |format| if @forum.update_attributes(params[:forum]) format.html { redirect_to(@forum, :notice => 'Forum was successfully updated.') } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @forum.errors, :status => :unprocessable_entity } end end end # DELETE /forums/1 # DELETE /forums/1.xml def destroy @forum = Forum.find(params[:id]) @forum.destroy respond_to do |format| format.html { redirect_to(forums_url) } format.xml { head :ok } end end end
Version data entries
7 entries across 7 versions & 1 rubygems