4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
# File 'lib/acts_as_assets/routes.rb', line 4
def assets_routes_for(resources)
resources = Array(resources)
resources.each do |r|
plural = r.to_s
singolar = plural.singularize
scope "#{plural}/:fk_name/assets/" do
get "get/:asset_id/(:style)/:filename.:extension" => "#{plural}/assets#get", :as => "#{plural}_get_asset"
get "*type" => "#{plural}/assets#index", :as => "#{singolar}_assets"
post "*type" => "#{plural}/assets#create", :as => "#{singolar}_create_asset"
delete ":asset_id" => "#{plural}/assets#destroy", :as => "#{singolar}_destroy_asset"
end
end
end
|