Sha256: 1f02e7d8ec4e62726a6c85e88b4fe344b5364197dfebdf5f17738cb730daf0fe
Contents?: true
Size: 1.75 KB
Versions: 2
Compression:
Stored size: 1.75 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(:header, :title, :page) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
trix_add_on-0.1.4 | test/dummy/app/controllers/pages_controller.rb |
trix_add_on-0.1.3 | test/dummy/app/controllers/pages_controller.rb |