Sha256: 0febe7a354592e3a0a30cd4bccac8f8041dd4e9a6fe987e2d3e030bf35ea7638

Contents?: true

Size: 771 Bytes

Versions: 22

Compression:

Stored size: 771 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 ||= next_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

22 entries across 22 versions & 1 rubygems

Version Path
effective_resources-1.8.9 app/controllers/concerns/effective/wizard_controller/save.rb
effective_resources-1.8.8 app/controllers/concerns/effective/wizard_controller/save.rb
effective_resources-1.8.7 app/controllers/concerns/effective/wizard_controller/save.rb
effective_resources-1.8.6 app/controllers/concerns/effective/wizard_controller/save.rb
effective_resources-1.8.5 app/controllers/concerns/effective/wizard_controller/save.rb
effective_resources-1.8.4 app/controllers/concerns/effective/wizard_controller/save.rb
effective_resources-1.8.3 app/controllers/concerns/effective/wizard_controller/save.rb
effective_resources-1.8.2 app/controllers/concerns/effective/wizard_controller/save.rb
effective_resources-1.8.1 app/controllers/concerns/effective/wizard_controller/save.rb
effective_resources-1.8.0 app/controllers/concerns/effective/wizard_controller/save.rb
effective_resources-1.7.8 app/controllers/concerns/effective/wizard_controller/save.rb
effective_resources-1.7.7 app/controllers/concerns/effective/wizard_controller/save.rb
effective_resources-1.7.6 app/controllers/concerns/effective/wizard_controller/save.rb
effective_resources-1.7.5 app/controllers/concerns/effective/wizard_controller/save.rb
effective_resources-1.7.4 app/controllers/concerns/effective/wizard_controller/save.rb
effective_resources-1.7.3 app/controllers/concerns/effective/wizard_controller/save.rb
effective_resources-1.7.2 app/controllers/concerns/effective/wizard_controller/save.rb
effective_resources-1.7.1 app/controllers/concerns/effective/wizard_controller/save.rb
effective_resources-1.7.0 app/controllers/concerns/effective/wizard_controller/save.rb
effective_resources-1.6.6 app/controllers/concerns/effective/wizard_controller/save.rb