Sha256: e7d8bc947ca8e2713f422e205f557b35855d2240a6406d9d9499217943f30122
Contents?: true
Size: 1.79 KB
Versions: 11
Compression:
Stored size: 1.79 KB
Contents
class PagesController < ApplicationController # GET /pages # GET /pages.json def index @pages = Page.all respond_to do |format| format.html # index.html.erb format.json { render json: @pages } end end # GET /pages/1 # GET /pages/1.json def show @page = Page.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @page } end end # GET /pages/new # GET /pages/new.json def new @page = Page.new respond_to do |format| format.html # new.html.erb format.json { render json: @page } end end # GET /pages/1/edit def edit @page = Page.find(params[:id]) end # POST /pages # POST /pages.json def create @page = Page.new(params[:page]) respond_to do |format| if @page.save format.html { redirect_to @page, notice: 'Page was successfully created.' } format.json { render json: @page, status: :created, location: @page } else format.html { render action: "new" } format.json { render json: @page.errors, status: :unprocessable_entity } end end end # PUT /pages/1 # PUT /pages/1.json def update @page = Page.find(params[:id]) respond_to do |format| if @page.update_attributes(params[:page]) format.html { redirect_to @page, notice: 'Page was successfully updated.' } format.json { head :ok } else format.html { render action: "edit" } format.json { render json: @page.errors, status: :unprocessable_entity } end end end # DELETE /pages/1 # DELETE /pages/1.json def destroy @page = Page.find(params[:id]) @page.destroy respond_to do |format| format.html { redirect_to pages_url } format.json { head :ok } end end end
Version data entries
11 entries across 11 versions & 1 rubygems