Sha256: 000edcb02528a8942d461158047732ae7b5157183b557ad9f1c856cc050b9892
Contents?: true
Size: 1.26 KB
Versions: 1
Compression:
Stored size: 1.26 KB
Contents
require_dependency "mo_page/application_controller" module MoPage class PagesController < ApplicationController before_action :set_page, only: [:show, :edit, :update, :destroy] # GET /pages def index @pages = Page.all end # GET /pages/1 def show end # GET /pages/new def new @page = Page.new end # GET /pages/1/edit def edit end # POST /pages def create @page = Page.new(page_params) if @page.save redirect_to @page, notice: 'Page was successfully created.' else render :new end end # PATCH/PUT /pages/1 def update if @page.update(page_params) redirect_to @page, notice: 'Page was successfully updated.' else render :edit end end # DELETE /pages/1 def destroy @page.destroy redirect_to pages_url, notice: 'Page was successfully destroyed.' end private # Use callbacks to share common setup or constraints between actions. def set_page @page = Page.find(params[:id]) end # Only allow a trusted parameter "white list" through. def page_params params.require(:page).permit(:title, :body, :key, :author_id, :node_id, :parent_id) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mo_page-0.0.2 | app/controllers/mo_page/pages_controller.rb |