class ActionDispatch::Routing::Mapper

Public Instance Methods

warning_paths_for(*resources) click to toggle source
# File lib/acts_as_warnable/rails/routes.rb, line 4
def warning_paths_for(*resources)
  resources.map(&:to_s).each do |resource|
    get "/#{resource.pluralize}/:warnable_id/warnings",
        to: 'acts_as_warnable/warnings#index',
        defaults: { warnable_type: resource.singularize.camelize },
        as: "#{resource.singularize}_warnings"

    post "/#{resource.pluralize}/:warnable_id/warnings",
         to: 'acts_as_warnable/warnings#post',
         defaults: { warnable_type: resource.singularize.camelize }
  end
end