Sha256: c2c10f9ee6acaf6e382b042d841663cd2cf5d0a19dcf6c560caac6b393e3b2e6

Contents?: true

Size: 1.33 KB

Versions: 96

Compression:

Stored size: 1.33 KB

Contents

module ActionController
  module Resources
    class Resource
      ACTIVE_SCAFFOLD_ROUTING = {
        :collection => {:show_search => :get, :update_table => :get, :edit_associated => :get, :list => :get, :new_existing => :get, :add_existing => :post, :render_field => :get, :print_list => :get, :show_customize => :get, :show_export_tool => :get, :reset_search => :get, :refresh => :get, :reset_customize => :get, :customize => :get, :export_tool => :get},
        :member => {:row => :get, :nested => :get, :edit_associated => :get, :add_association => :get, :update_column => :post, :destroy_existing => :delete, :render_field => :get, :delete => :get}
      }

      # by overwriting the attr_reader :options, we can parse out a special :active_scaffold flag just-in-time.
      def options_with_active_scaffold
        if @options.delete :active_scaffold
          logger.info "ActiveScaffold: extending RESTful routes for #{@plural}"
          @options[:collection] ||= {}
          @options[:collection].merge! ACTIVE_SCAFFOLD_ROUTING[:collection]
          @options[:member] ||= {}
          @options[:member].merge! ACTIVE_SCAFFOLD_ROUTING[:member]
        end
        options_without_active_scaffold
      end
      alias_method_chain :options, :active_scaffold

      def logger
        ActionController::Base::logger
      end
    end
  end
end

Version data entries

96 entries across 96 versions & 1 rubygems

Version Path
six-updater-web-0.24.15 lib/six-updater-web/vendor/plugins/active_scaffold/lib/extensions/resources.rb
six-updater-web-0.24.14 lib/six-updater-web/vendor/plugins/active_scaffold/lib/extensions/resources.rb
six-updater-web-0.24.13 lib/six-updater-web/vendor/plugins/active_scaffold/lib/extensions/resources.rb
six-updater-web-0.24.12 lib/six-updater-web/vendor/plugins/active_scaffold/lib/extensions/resources.rb
six-updater-web-0.24.11 lib/six-updater-web/vendor/plugins/active_scaffold/lib/extensions/resources.rb
six-updater-web-0.24.10 lib/six-updater-web/vendor/plugins/active_scaffold/lib/extensions/resources.rb
six-updater-web-0.24.9 lib/six-updater-web/vendor/plugins/active_scaffold/lib/extensions/resources.rb
six-updater-web-0.24.8 lib/six-updater-web/vendor/plugins/active_scaffold/lib/extensions/resources.rb
six-updater-web-0.24.7 lib/six-updater-web/vendor/plugins/active_scaffold/lib/extensions/resources.rb
six-updater-web-0.24.6 lib/six-updater-web/vendor/plugins/active_scaffold/lib/extensions/resources.rb
six-updater-web-0.24.5 lib/six-updater-web/vendor/plugins/active_scaffold/lib/extensions/resources.rb
six-updater-web-0.24.4 lib/six-updater-web/vendor/plugins/active_scaffold/lib/extensions/resources.rb
six-updater-web-0.24.3 lib/six-updater-web/vendor/plugins/active_scaffold/lib/extensions/resources.rb
six-updater-web-0.24.2 lib/six-updater-web/vendor/plugins/active_scaffold/lib/extensions/resources.rb
six-updater-web-0.24.1 lib/six-updater-web/vendor/plugins/active_scaffold/lib/extensions/resources.rb
six-updater-web-0.24.0 lib/six-updater-web/vendor/plugins/active_scaffold/lib/extensions/resources.rb
six-updater-web-0.23.7 lib/six-updater-web/vendor/plugins/active_scaffold/lib/extensions/resources.rb
six-updater-web-0.23.6 lib/six-updater-web/vendor/plugins/active_scaffold/lib/extensions/resources.rb
six-updater-web-0.23.5 lib/six-updater-web/vendor/plugins/active_scaffold/lib/extensions/resources.rb
six-updater-web-0.23.4 lib/six-updater-web/vendor/plugins/active_scaffold/lib/extensions/resources.rb