4
5
6
7
8
9
10
11
12
13
14
15
|
# 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
|