Rails Rails 中 content for 和 provide 有什么区别?

wl1991724 · 2015年06月19日 · 最后由 dandananddada 回复于 2015年06月19日 · 2270 次阅读

看的不是很懂

# The same as +content_for+ but when used with streaming flushes
      # straight back to the layout. In other words, if you want to
      # concatenate several times to the same buffer when rendering a given
      # template, you should use +content_for+, if not, use +provide+ to tell
      # the layout to stop looking for more contents.
      def provide(name, content = nil, &block)
        content = capture(&block) if block_given?
        result = @view_flow.append!(name, content) if content
        result unless content
      end

#1 楼 @dandananddada rubyer 是什么鬼?还有 pythoner,pyer 都是什么鬼?

#2 楼 @alixiaomiao Do not 在意这些细节。。。其实我看成 ruby.me 了。。 @camel (Cam)

需要 登录 后方可回复, 如果你还没有账号请 注册新账号