@@ -46,30 +46,6 class ApplicationController < ActionController::Base | |||||
46 | end |
|
46 | end | |
47 | end |
|
47 | end | |
48 |
|
48 | |||
49 | # FIXME: Remove this when all of Rack and Rails have learned how to |
|
|||
50 | # properly use encodings |
|
|||
51 | before_filter :params_filter |
|
|||
52 |
|
||||
53 | def params_filter |
|
|||
54 | if RUBY_VERSION >= '1.9' && defined?(Rails) && Rails::VERSION::MAJOR < 3 |
|
|||
55 | self.utf8nize!(params) |
|
|||
56 | end |
|
|||
57 | end |
|
|||
58 |
|
||||
59 | def utf8nize!(obj) |
|
|||
60 | if obj.frozen? |
|
|||
61 | obj |
|
|||
62 | elsif obj.is_a? String |
|
|||
63 | obj.respond_to?(:force_encoding) ? obj.force_encoding("UTF-8") : obj |
|
|||
64 | elsif obj.is_a? Hash |
|
|||
65 | obj.each {|k, v| obj[k] = self.utf8nize!(v)} |
|
|||
66 | elsif obj.is_a? Array |
|
|||
67 | obj.each {|v| self.utf8nize!(v)} |
|
|||
68 | else |
|
|||
69 | obj |
|
|||
70 | end |
|
|||
71 | end |
|
|||
72 |
|
||||
73 | before_filter :user_setup, :check_if_login_required, :set_localization |
|
49 | before_filter :user_setup, :check_if_login_required, :set_localization | |
74 |
|
50 | |||
75 | rescue_from ActionController::InvalidAuthenticityToken, :with => :invalid_authenticity_token |
|
51 | rescue_from ActionController::InvalidAuthenticityToken, :with => :invalid_authenticity_token |
General Comments 0
You need to be logged in to leave comments.
Login now