<commit_before># Extend the Base ActionController to support multiple site
ActionController::Base.class_eval do 

  attr_accessor :current_site

  # Use this in your controller just like the <tt>layout</tt> macro.
  # Example:
  #
  #  site 'maybe_domain'
  #
  # -or-
  #
  #  site :get_site
  #
  #  def get_site
  #    'maybe_domain'
  #  end
  def self.site(site_name)
    write_inheritable_attribute "site", site_name
    around_filter :temporarily_add_multisite_path
  end

  # Retrieves the current set site
  def current_site(passed_site=nil)
    site = passed_site || self.class.read_inheritable_attribute("site")

    @active_site = case site
      when Symbol then send(site)
      when Proc   then site.call(self)
      when String then site
    end
  end

  protected
  def temporarily_add_multisite_path
    if current_site
      begin
        ActionController::Base.view_paths.unshift(File.join(RAILS_ROOT,'sites', @active_site, 'views'))
        logger.debug "paths: " + ActionController::Base.view_paths.join(":")
        yield
      ensure
        ActionController::Base.view_paths.shift
      end
    else
      true
    end
  end
end<commit_msg>Fixed semantics so around_filter yields correctly<commit_after># Extend the Base ActionController to support multiple site
ActionController::Base.class_eval do 

  attr_accessor :current_site

  # Use this in your controller just like the <tt>layout</tt> macro.
  # Example:
  #
  #  site 'maybe_domain'
  #
  # -or-
  #
  #  site :get_site
  #
  #  def get_site
  #    'maybe_domain'
  #  end
  def self.site(site_name)
    write_inheritable_attribute "site", site_name
    around_filter :temporarily_add_multisite_path
  end

  # Retrieves the current set site
  def current_site(passed_site=nil)
    site = passed_site || self.class.read_inheritable_attribute("site")

    @active_site = case site
      when Symbol then send(site)
      when Proc   then site.call(self)
      when String then site
    end
  end

  protected
  def temporarily_add_multisite_path
    if current_site
      begin
        ActionController::Base.view_paths.unshift(File.join(RAILS_ROOT,'sites', @active_site, 'views'))
        logger.debug "paths: " + ActionController::Base.view_paths.join(":")
        yield
      ensure
        ActionController::Base.view_paths.shift
      end
    else
      yield
    end
  end
end
{'fraction_non_alphanumeric': 0.08111533586818757, 'fraction_numerical': 0.0, 'mean_word_length': 3.096885813148789, 'pattern_counts': {'":': 2, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4209052', 'n_tokens_mistral': 768, 'n_tokens_neox': 745, 'n_words': 182}