Sha256: 7466cf4ae9950026f3356ac3f88e1f463331e07e4f1ce6327847b3d47eef6a62

Contents?: true

Size: 774 Bytes

Versions: 2

Compression:

Stored size: 774 Bytes

Contents

module Wicked
  module Wizard
    extend ActiveSupport::Concern

    included do
      use_focused_macros
      focused_action :index, "#{self.name}::Action".constantize do
        run do
          redirect_to wizard_path(steps.first)
        end
      end 
    end

    module ClassMethods
      def wizard_actions *names
        names.each do |name|
          wizard_action name
        end
      end

      def wizard_action action, &block
        focused_action action, "#{self.name}::Action".constantize, &block
      end

      def show_wizard &block
        focused_action :show, "#{self.name}::Action".constantize, &block
      end

      def update_wizard &block
        focused_action :update, "#{self.name}::Action".constantize, &block
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
wicked-focused-0.2.2 lib/wicked/wizard.rb
wicked-focused-0.2.1 lib/wicked/wizard.rb