Ticket #437: fix_format_extension.diff
| File fix_format_extension.diff, 1.2 kB (added by chr..@oxdi.eu, 10 months ago) |
|---|
-
lib/merb/mixins/general_controller.rb
old new 161 161 end 162 162 163 163 # +format_extension+ dictates when named route URLs generated by the url 164 # method will have a file extension. It will return either falseor the format164 # method will have a file extension. It will return either nil or the format 165 165 # extension to append. 166 166 # 167 167 # ==== Configuration Options … … 192 192 # # => /products/3 193 193 # 194 194 def format_extension(new_params={}) 195 use_format = Merb::Config[:use_format_in_urls] 196 if use_format.nil? 197 prms = params.merge(new_params) 198 use_format = prms[:format] != 'html' && prms[:format] 195 format = params.merge(new_params)[:format] || 'html' 196 if format != 'html' || always_use_format_extension? 197 format || 'html' 199 198 end 200 use_format201 199 end 202 200 201 def always_use_format_extension? 202 Merb::Config[:use_format_in_urls] 203 end 204 203 205 204 206 # Creates an MD5 hashed token based on the current time. 205 207 #
