Sha256: 59fd8b7e3a64b040e1634fdd806863decbfb617b44dbfcbd4d9dc3c2029ecbaf

Contents?: true

Size: 850 Bytes

Versions: 14

Compression:

Stored size: 850 Bytes

Contents

module Effective
  module WizardController
    module Save

      def save_wizard_resource(resource, action = nil, options = {})
        was_new_record = resource.new_record?
        action ||= resource.respond_to?("#{step}!") ? step : :save

        if save_resource(resource, action)
          flash[:success] ||= options.delete(:success) || resource_flash(:success, resource, action)

          @skip_to ||= resource.required_steps.find { |s| s == next_step } || resource.first_uncompleted_step
          @redirect_to ||= resource_wizard_path(resource, @skip_to) if was_new_record

          redirect_to(@redirect_to || wizard_path(@skip_to))
        else
          flash.now[:danger] = options.delete(:error) || resource_flash(:danger, resource, action)
          render_step(wizard_value(step), options)
        end
      end

    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
effective_resources-1.8.30 app/controllers/concerns/effective/wizard_controller/save.rb
effective_resources-1.8.29 app/controllers/concerns/effective/wizard_controller/save.rb
effective_resources-1.8.28 app/controllers/concerns/effective/wizard_controller/save.rb
effective_resources-1.8.27 app/controllers/concerns/effective/wizard_controller/save.rb
effective_resources-1.8.26 app/controllers/concerns/effective/wizard_controller/save.rb
effective_resources-1.8.25 app/controllers/concerns/effective/wizard_controller/save.rb
effective_resources-1.8.24 app/controllers/concerns/effective/wizard_controller/save.rb
effective_resources-1.8.23 app/controllers/concerns/effective/wizard_controller/save.rb
effective_resources-1.8.22 app/controllers/concerns/effective/wizard_controller/save.rb
effective_resources-1.8.21 app/controllers/concerns/effective/wizard_controller/save.rb
effective_resources-1.8.20 app/controllers/concerns/effective/wizard_controller/save.rb
effective_resources-1.8.19 app/controllers/concerns/effective/wizard_controller/save.rb
effective_resources-1.8.18 app/controllers/concerns/effective/wizard_controller/save.rb
effective_resources-1.8.17 app/controllers/concerns/effective/wizard_controller/save.rb