Sha256: 5f85dfa3a9e02cd21e55657ec4d9b305d52b4ae963c4976fc26f5fd2a5c2c358
Contents?: true
Size: 1.45 KB
Versions: 1
Compression:
Stored size: 1.45 KB
Contents
# app/concerns/stair_master/controller.rb ## ## ## module StairMaster module Controller extend ActiveSupport::Concern include ::StairMaster::Concerns::Traversal include ::StairMaster::Concerns::Getters include ::StairMaster::Concerns::Ordering include ::StairMaster::Concerns::Tests include ::StairMaster::Concerns::Routing included do helper_method :workflow_map, :params_for_redirect before_filter :check_step_availability, only: [:show, :update] end def workflow_map @stair_master_workflow_map ||= self.class.workflow_map.new end private # --------------------------------------------- ## Override this method in your controller to set the params def params_for_redirect(*bad_keys) mod_params = params default_keys = [:action, :controller, :authenticity_token, :utf8] (bad_keys + default_keys).each do |k| mod_params.delete k end mod_params.empty? ? nil : mod_params end def check_step_availability if is_available_step? redirect_to next_step_path(params_for_redirect) if step_should_be_skipped? else redirect_to first_step_path(params_for_redirect) end end module ClassMethods def workflow_map(map_class=nil) return (@@stair_master_workflow_map || ::StairMaster::WorkflowMap) if map_class.nil? @@stair_master_workflow_map = map_class.to_s.camelize.constantize end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
stair_master-0.0.3 | app/concerns/stair_master/controller.rb |