<commit_before>class OrganizationsController < ApplicationController
  caches_action :index, 
                expires_in: 1.hour, 
                unless: :current_user, 
                cache_path: Proc.new { request.url + (params[:page]||'') }
  caches_action :show, 
                expires_in: 1.hour, 
                unless: :current_user

  before_action :set_organization, only: [:show]

  # GET /organizations
  # GET /organizations.json
  def index
    @title = 'Organizaciones'
    @organizations = (can? :manage, Entity) ? Entity.organizations : Entity.organizations.published
    @organizations = @organizations.order("updated_at DESC").page(params[:page]).per(16)
  end

  # GET /organizations/1
  # GET /organizations/1.json
  def show
    authorize! :read, @organization
    @title = @organization.short_or_long_name
    @relations = (can? :manage, Entity) ? @organization.relations : @organization.relations.published

    # Facebook Open Graph metadata
    @fb_description = @organization.description unless @organization.description.blank?
    @fb_image_url = @organization.avatar.url() unless @organization.avatar.nil?
  end<commit_msg>Add ETag support for Organizatins #140<commit_after>class OrganizationsController < ApplicationController
  before_action :set_organization, only: [:show]

  etag { can? :manage, Entity } # Don't cache admin content together with the rest

  # GET /organizations
  # GET /organizations.json
  def index
    @title = 'Organizaciones'
    @organizations = (can? :manage, Entity) ? Entity.organizations : Entity.organizations.published
    if stale?(@organizations, :public => current_user.nil?)
      @organizations = @organizations.order("updated_at DESC").page(params[:page]).per(16)
    end
  end

  # GET /organizations/1
  # GET /organizations/1.json
  def show
    authorize! :read, @organization
    if stale?(@organization, :public => current_user.nil?)
      @title = @organization.short_or_long_name
      @relations = (can? :manage, Entity) ? @organization.relations : @organization.relations.published

      # Facebook Open Graph metadata
      @fb_description = @organization.description unless @organization.description.blank?
      @fb_image_url = @organization.avatar.url() unless @organization.avatar.nil?
    end
  end
{'fraction_non_alphanumeric': 0.10999563509384548, 'fraction_numerical': 0.005674378000872981, 'mean_word_length': 3.7257731958762887, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7648760', 'n_tokens_mistral': 706, 'n_tokens_neox': 647, 'n_words': 152}