Changeset 1284

Show
Ignore:
Timestamp:
01/11/08 19:20:48 (9 months ago)
Author:
iv..@gweezlebur.com
Message:

fix format_extension / Closes #437 / Thanks chris

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/merb/mixins/general_controller.rb

    r1228 r1284  
    162162     
    163163    # +format_extension+ dictates when named route URLs generated by the url 
    164     # method will have a file extension. It will return either false or the format  
     164    # method will have a file extension. It will return either nil or the format  
    165165    # extension to append. 
    166166    # 
     
    193193    # 
    194194    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] 
    199       end 
    200       use_format 
     195      format = params.merge(new_params)[:format] || 'html' 
     196      if format != 'html' || always_use_format_extension? 
     197        format || 'html' 
     198      end 
     199    end 
     200     
     201    def always_use_format_extension? 
     202      Merb::Config[:use_format_in_urls] 
    201203    end 
    202204