How to use string interpolation when rendering templates?
- by Senthil
I found this code in a Rails cookbook.
class BlogController < ApplicationController
def display_by_date
year = params[:year]
month = params[:month]
day = params[:day]
day ='0'+day if day && day.size == 1
@day = day
if ( year && month && day )
render(:template => "blog/#{year}/#{month}/#{day}")
elsif ( year )
render(:template => "blog/#{year}/list")
end
end
end
I'm not sure what to name the templates so the router can find them. Thanks for your help.