eBooru/app/controllers/email_blacklists_controller.rb
Earlopain fc7d84affd
[RuboCop] Enable Style/FrozenStringLiteralComment
This reduces allocations on the posts page by about 5%, from basic testing
2024-02-25 18:15:55 +01:00

38 lines
797 B
Ruby

# frozen_string_literal: true
class EmailBlacklistsController < ApplicationController
respond_to :html, :json, :js
before_action :admin_only
def index
@blacklists = EmailBlacklist.search(search_params).paginate(params[:page], limit: params[:limit])
respond_with(@blacklists)
end
def new
@blacklist = EmailBlacklist.new
end
def create
@blacklist = EmailBlacklist.create(blacklist_params)
respond_with(@blacklist, location: email_blacklists_path)
end
def destroy
@blacklist = EmailBlacklist.find(params[:id])
@blacklist.destroy
respond_with(@blacklist)
end
private
def search_params
permit_search_params %i[order domain reason]
end
def blacklist_params
params.require(:email_blacklist).permit(%i[domain reason])
end
end