Sha256: e963265562b02cce1bd0b416ab1ecac0318c7ad7c846cb02764dd52e6e71dd9d

Contents?: true

Size: 939 Bytes

Versions: 3

Compression:

Stored size: 939 Bytes

Contents

module Spontaneous::Rack::Back
  class Schema < Base
    # Use the CSRF verification step separately from the main app
    # because it conflicts with the Index application:
    # The index application needs to load without CSRF validation
    # and the Schema app needs CSRF validation
    # but the Schema app has be before Index in the stack
    use Spontaneous::Rack::Middleware::CSRF::Verification

    def schema
      Spontaneous.schema
    end

    post "/delete" do
      begin
        schema.apply_fix(:delete, params[:uid])
      rescue Spot::SchemaModificationError # ignore remaining errors - they will be fixed later
      end
      redirect(params[:origin])
    end

    post "/rename" do
      begin
        schema.apply_fix(:rename, params[:uid], params[:ref])
      rescue Spot::SchemaModificationError => e # ignore remaining errors - they will be fixed later
      end
      redirect(params[:origin])
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
spontaneous-0.2.0.beta4 lib/spontaneous/rack/back/schema.rb
spontaneous-0.2.0.beta3 lib/spontaneous/rack/back/schema.rb
spontaneous-0.2.0.beta2 lib/spontaneous/rack/back/schema.rb