weather/app/controllers/admin/ruling_weathers_controller.rb

33 lines
1020 B
Ruby

class Admin::RulingWeathersController < OrbitAdminController
include Admin::RulingWeathersHelper
before_action ->(module_app = @app_title) { set_variables module_app }
def initialize
super
@app_title = "ruling_weather"
end
def index
@settings = RulingWeatherSetting.all.page(params[:page]).per(10)
end
def destroy
RulingWeatherSetting.where(:id=>params[:id]).destroy
redirect_to :back
end
def edit_setting
@ruling_weather_setting = RulingWeatherSetting.find(params[:id])
end
def new_setting
@ruling_weather_setting = RulingWeatherSetting.new
end
def update_setting
@ruling_weather_setting = RulingWeatherSetting.find(params[:id])
@ruling_weather_setting.update_attributes(ruling_weather_setting_params)
redirect_to params[:referer_url]
end
def create_setting
@ruling_weather_setting = RulingWeatherSetting.create(ruling_weather_setting_params)
redirect_to params[:referer_url]
end
def ruling_weather_setting_params
params.require(:ruling_weather_setting).permit!
end
end