?? action_controller.rb
字號:
#decorate ActionController::Base for render :amfrequire 'app/request_store'ActionController::Base.class_eval do def render_with_amf(options = nil, &block) begin if options != nil && options.keys.include?(:amf) #store results on RequestStore, can't prematurely return or send_data. RubyAMF::App::RequestStore.render_amf_results = options[:amf] RubyAMF::Configuration::ClassMappings.current_mapping_scope = options[:class_mapping_scope]||RubyAMF::Configuration::ClassMappings.default_mapping_scope else render_without_amf(options,&block) end rescue Exception => e #suppress missing template warnings raise e if !e.message.match(/^Missing template/) end end alias_method_chain :render, :amfend#This class extends ActionController::Baseclass ActionController::Base attr_accessor :is_amf attr_accessor :is_rubyamf #-> for simeon :)- #Higher level "credentials" method that returns credentials wether or not #it was from setRemoteCredentials, or setCredentials def credentials empty_auth = {:username => nil, :password => nil} amf_credentials||html_credentials||empty_auth #return an empty auth, this watches out for being the cause of an exception, (nil[]) end private #setCredentials access def amf_credentials RequestStore.rails_authentication end #remoteObject setRemoteCredentials retrieval def html_credentials auth_data = request.env['RAW_POST_DATA'] auth_data = auth_data.scan(/DSRemoteCredentials.*?\001/) if auth_data.size > 0 auth_data = auth_data[0][21, auth_data[0].length-22] remote_auth = Base64.decode64(auth_data).split(':')[0..1] else return nil end return {:username => remote_auth[0], :password => remote_auth[1]} end end
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -