Sha256: 2d8588c9f3d83a02d396e6e5754401ce5d2d9a3baa7ce4357f93edb1322fcfd4

Contents?: true

Size: 1.74 KB

Versions: 9

Compression:

Stored size: 1.74 KB

Contents

class PagesController < ApplicationController
  before_action :set_page, only: [:show, :edit, :update, :destroy]

  # GET /pages
  # GET /pages.json
  def index
    @pages = Page.all
  end

  # GET /pages/1
  # GET /pages/1.json
  def show
  end

  # GET /pages/new
  def new
    @page = Page.new
  end

  # GET /pages/1/edit
  def edit
  end

  # POST /pages
  # POST /pages.json
  def create
    @page = Page.new(page_params)

    respond_to do |format|
      if @page.save
        format.html { redirect_to @page, notice: 'Page was successfully created.' }
        format.json { render :show, status: :created, location: @page }
      else
        format.html { render :new }
        format.json { render json: @page.errors, status: :unprocessable_entity }
      end
    end
  end

  # PATCH/PUT /pages/1
  # PATCH/PUT /pages/1.json
  def update
    respond_to do |format|
      if @page.update(page_params)
        format.html { redirect_to @page, notice: 'Page was successfully updated.' }
        format.json { render :show, status: :ok, location: @page }
      else
        format.html { render :edit }
        format.json { render json: @page.errors, status: :unprocessable_entity }
      end
    end
  end

  # DELETE /pages/1
  # DELETE /pages/1.json
  def destroy
    @page.destroy
    respond_to do |format|
      format.html { redirect_to pages_url, notice: 'Page was successfully destroyed.' }
      format.json { head :no_content }
    end
  end

  private
    # Use callbacks to share common setup or constraints between actions.
    def set_page
      @page = Page.find(params[:id])
    end

    # Never trust parameters from the scary internet, only allow the white list through.
    def page_params
      params.require(:page).permit(:name, :content)
    end
end

Version data entries

9 entries across 3 versions & 1 rubygems

Version Path
omniauth-infinum-0.11.1 examples/omniauth_infinum_with_facebook/app/controllers/pages_controller.rb
omniauth-infinum-0.11.1 examples/omniauth_infinum_standalone/app/controllers/pages_controller.rb
omniauth-infinum-0.11.1 examples/devise_and_omniauth_infinum/app/controllers/pages_controller.rb
omniauth-infinum-0.10.0 examples/devise_and_omniauth_infinum/app/controllers/pages_controller.rb
omniauth-infinum-0.10.0 examples/omniauth_infinum_standalone/app/controllers/pages_controller.rb
omniauth-infinum-0.10.0 examples/omniauth_infinum_with_facebook/app/controllers/pages_controller.rb
omniauth-infinum-0.10.1 examples/omniauth_infinum_with_facebook/app/controllers/pages_controller.rb
omniauth-infinum-0.10.1 examples/omniauth_infinum_standalone/app/controllers/pages_controller.rb
omniauth-infinum-0.10.1 examples/devise_and_omniauth_infinum/app/controllers/pages_controller.rb