Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby-on-rails-4/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 4 Spree-对ViewContext模块感到困惑_Ruby On Rails 4_Internationalization_Spree - Fatal编程技术网

Ruby on rails 4 Spree-对ViewContext模块感到困惑

Ruby on rails 4 Spree-对ViewContext模块感到困惑,ruby-on-rails-4,internationalization,spree,Ruby On Rails 4,Internationalization,Spree,任何善良的灵魂都能帮助我了解lib/spree/i18n/base.rb下spree的上述代码吗?如何评估“def self.context=context”?ViewContext模块的用途和用例是什么?提前谢谢 module Spree module ViewContext def self.context=(context) @context = context end def self.context @context en

任何善良的灵魂都能帮助我了解lib/spree/i18n/base.rb下spree的上述代码吗?如何评估“def self.context=context”?ViewContext模块的用途和用例是什么?提前谢谢

module Spree
  module ViewContext

    def self.context=(context)
      @context = context
    end

    def self.context
      @context
    end

    def view_context
      super.tap do |context|
        Spree::ViewContext.context = context
      end
    end
  end
end