Sha256: 14b75b157164831e78aa4b44255ef1c4555dd652090ea3020dbe4ea0d239f71f
Contents?: true
Size: 1.31 KB
Versions: 21
Compression:
Stored size: 1.31 KB
Contents
# frozen_string_literal: true class Admin::RedirectsController < Admin::BaseController before_action :set_redirect, only: [:edit, :update, :destroy] def index @redirects = Redirect.where(content_id: nil).order("id desc").page(params[:page]). per(this_blog.admin_display_elements) @redirect = Redirect.new end def edit @redirects = Redirect.where(content_id: nil).order("id desc").page(params[:page]). per(this_blog.admin_display_elements) end def create @redirect = this_blog.redirects.build(redirect_params) if @redirect.save redirect_to admin_redirects_url, notice: "Redirect was successfully created." else render :index end end def update if @redirect.update(redirect_params) redirect_to admin_redirects_url, notice: "Redirect was successfully updated." else render :edit end end def destroy @redirect.destroy redirect_to admin_redirects_url, notice: I18n.t("admin.redirects.destroy.success") end private # Use callbacks to share common setup or constraints between actions. def set_redirect @redirect = Redirect.find(params[:id]) end # Never trust parameters from the scary internet, only allow the white list through. def redirect_params params.require(:redirect).permit(:from_path, :to_path) end end
Version data entries
21 entries across 21 versions & 2 rubygems