kala-tamin Does map.connect accept a wildcard-style format in the URL?


Does map.connect accept a wildcard-style format in the URL?



If I want to match x.gif and y.gif, is it possible to pass a URL to map.connect that encompasses the possibilities of both filenames something like this:

map.connect "public/images/:name.gif",   :controller => "static_image_controller",   :action => "serve" 

And then receive the param in my StaticImageController as 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 convention over configuration in Rais, does this look right?




How to specify join conditions in Rails for belongs_to assocation?

1:



How do I override rails naming conventions?
map.connect '/public/images/:filename', :filename => /\.gif$/ 
will do it..
Solutions for tracking cucumber features and scenarios? [closed]


Framework design patterns


91 out of 100 based on 71 user ratings 421 reviews