diff options
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_controller/mime_type.rb | 10 | ||||
-rw-r--r-- | actionpack/lib/action_controller/session_management.rb | 4 |
2 files changed, 14 insertions, 0 deletions
diff --git a/actionpack/lib/action_controller/mime_type.rb b/actionpack/lib/action_controller/mime_type.rb index 79da49e789..17b3d861ec 100644 --- a/actionpack/lib/action_controller/mime_type.rb +++ b/actionpack/lib/action_controller/mime_type.rb @@ -139,6 +139,16 @@ module Mime def ==(mime_type) (@synonyms + [ self ]).any? { |synonym| synonym.to_s == mime_type.to_s } if mime_type end + + private + def method_missing(method, *args) + if method.to_s =~ /(\w+)\?$/ + mime_type = $1.downcase.to_sym + mime_type == @symbol || (mime_type == :html && @symbol == :all) + else + super + end + end end end diff --git a/actionpack/lib/action_controller/session_management.rb b/actionpack/lib/action_controller/session_management.rb index 60b0cd5f94..24f1651b00 100644 --- a/actionpack/lib/action_controller/session_management.rb +++ b/actionpack/lib/action_controller/session_management.rb @@ -61,6 +61,10 @@ module ActionController #:nodoc: # session :off, :only => :foo, # :if => Proc.new { |req| req.parameters[:ws] } # + # # the session will be disabled for non html/ajax requests + # session :off, + # :if => Proc.new { |req| !(req.format.html? || req.format.js?) } + # # All session options described for ActionController::Base.process_cgi # are valid arguments. def session(*args) |