adds settings area to admin
This commit is contained in:
17
app/controllers/admin/settings_controller.rb
Normal file
17
app/controllers/admin/settings_controller.rb
Normal file
@@ -0,0 +1,17 @@
|
||||
class Admin::SettingsController < Admin::BaseController
|
||||
|
||||
def index
|
||||
@settings = Setting.all
|
||||
end
|
||||
|
||||
def update
|
||||
@setting = Setting.find(params[:id])
|
||||
@setting.update(settings_params)
|
||||
redirect_to admin_settings_path, notice: t("admin.settings.flash.updated")
|
||||
end
|
||||
|
||||
private
|
||||
def settings_params
|
||||
params.require(:setting).permit(:value)
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user