Class: Hicube::ApplicationController
- Inherits:
-
ActionController::Base
- Object
- ActionController::Base
- Hicube::ApplicationController
- Defined in:
- app/controllers/hicube/application_controller.rb
Direct Known Subclasses
Constant Summary collapse
- FLASH_TYPES =
Constants
[ :debug, :error, :notice, :alert, :success, :warning, ]
Instance Method Summary collapse
- #after_sign_in_path_for(resource) ⇒ Object
-
#notify(type, message, options = {}) ⇒ Object
Generate a notification message.
- #notify_now(type, message, options = {}) ⇒ Object
Instance Method Details
#after_sign_in_path_for(resource) ⇒ Object
41 42 43 |
# File 'app/controllers/hicube/application_controller.rb', line 41 def after_sign_in_path_for(resource) return request.env['omniauth.origin'] || stored_location_for(resource) || '/hicube/pages/index/edit' end |
#notify(type, message, options = {}) ⇒ Object
Generate a notification message.
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'app/controllers/hicube/application_controller.rb', line 46 def notify(type, , = {}) [:now] ||= false # Convert and cleanup. type = type.to_s.downcase.to_sym # Sanity check for type. unless FLASH_TYPES.include?(type) raise ArgumentError, "Invalid value for argument type: #{type}, expected one of: #{FLASH_TYPES.to_sentence}." end logger.info("FLASH (#{.inspect}) #{type.to_s.upcase}: #{}") if [:now] == true flash.now[type] ||= [] flash.now[type] << else flash[type] ||= [] flash[type] << end logger.debug("DEBUG: FLASH #{flash.inspect}") return true end |
#notify_now(type, message, options = {}) ⇒ Object
72 73 74 75 |
# File 'app/controllers/hicube/application_controller.rb', line 72 def notify_now(type, , = {}) [:now] = true notify(type, , ) end |