If I need to map and , is it possible to pass the URL to , which includes the capabilities of both file names something like this: x.gify.gifmap.connect
map.connect "public/images/:name.gif",
:controller => "static_image_controller",
:action => "serve"
And then get paramin my StaticImageControllerhow params[:name]?
class StaticImageController < ApplicationController
def serve
image_name = params[:name]
image = File.read(File.join(Rails.root, image_name))
send_data image, :type => "image/gif", :disposition => "inline"
end
end
Besides the fact that what I am doing here violates the principles of the convention over configuration in Rais, does this look right?
source
share