Class: HomesteadingPublisher::SettingsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- HomesteadingPublisher::SettingsController
- Defined in:
- app/controllers/homesteading_publisher/settings_controller.rb
Instance Method Summary collapse
Instance Method Details
#edit ⇒ Object
14 15 16 17 |
# File 'app/controllers/homesteading_publisher/settings_controller.rb', line 14 def edit @setting = Setting.find(params[:id]) @page_title = "Editing Setting : #{@setting.name}" end |
#index ⇒ Object
6 7 8 |
# File 'app/controllers/homesteading_publisher/settings_controller.rb', line 6 def index @page_title = "Settings" end |
#show ⇒ Object
10 11 12 |
# File 'app/controllers/homesteading_publisher/settings_controller.rb', line 10 def show redirect_to settings_path end |
#update ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'app/controllers/homesteading_publisher/settings_controller.rb', line 19 def update @setting = Setting.find(params[:id]) content = ( @setting.name.downcase == "license" ? License.find(setting_params[:content]).short_code : @setting.content ) notice = "<h4>Setting: was successfully updated.</h4> <p><b>#{@setting.name}</b> : #{content}</p>".html_safe if @setting.update(setting_params) redirect_to settings_path, notice: notice else render action: "edit" end end |