module Voltron::Upload::Routes

Public Instance Methods

upload_for(resource, options={}) click to toggle source
# File lib/voltron/upload/action_dispatch/routes.rb, line 5
def upload_for(resource, options={})
  controller = resource.to_s.underscore
  options = options.with_indifferent_access

  options[:path] ||= "/#{controller}/upload"
  options[:controller] ||= controller

  post options[:path].gsub(/(^\/+|\/+$)/, ''), to: "#{options[:controller]}#upload", as: "upload_#{controller}"
end