Sha256: d960d2da45a8be85789715b2484daec9a207bb2fb6b39a10b8cfc36e796be9f4

Contents?: true

Size: 506 Bytes

Versions: 3

Compression:

Stored size: 506 Bytes

Contents

class ActionDispatch::Routing::Mapper
  def databound(*resources)
    namespace = @scope[:path]
    namespace = namespace[1..-1] if namespace

    resources.each do |resource|
      Rails.application.routes.draw do
        %i(where create update destroy).each do |name|
          path = [namespace, resource, name].compact.join('/')
          controller = [namespace, resource].compact.join('/')
          to = [controller, name].join('#')
          post path => to
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
databound-0.1.1 lib/databound/rails/routes.rb
databound-0.1.0 lib/databound/rails/routes.rb
databound-0.0.3 lib/databound/rails/routes.rb