<commit_before>class MembershipsController < ApplicationController
  before_filter :login_required
  load_and_authorize_resource 
  
  rescue_from CanCan::AccessDenied do |exception|
    flash[:error] = exception.message
    respond_to do |format|
      format.html {redirect_to @membership.group}
    end
  end

  def index
    @group = Group.find(params[:group_id])

    @selected_category = params[:category_id].nil? ? nil : Category.find(params[:category_id])
    @selected_neighborhood = params[:neighborhood_id].nil? ? nil : Neighborhood.find(params[:neighborhood_id])

    @memberships = Membership.search(@selected_neighborhood || @selected_category, 
                                     @group, 
                                     params[:page], 
                                     AJAX_POSTS_PER_PAGE, 
                                     params[:search]
                                     )

    respond_to do |format|
      format.js
    end
  end

  def show
    @person = @membership.person
    @account = @person.account(@membership.group)
    respond_to do |format|
      format.js<commit_msg>return correct data format in memberships#show when opened in a new browser tab. closes gh-124<commit_after>class MembershipsController < ApplicationController
  before_filter :login_required
  load_and_authorize_resource 
  
  rescue_from CanCan::AccessDenied do |exception|
    flash[:error] = exception.message
    respond_to do |format|
      format.html {redirect_to @membership.group}
    end
  end

  def index
    @group = Group.find(params[:group_id])

    @selected_category = params[:category_id].nil? ? nil : Category.find(params[:category_id])
    @selected_neighborhood = params[:neighborhood_id].nil? ? nil : Neighborhood.find(params[:neighborhood_id])

    @memberships = Membership.search(@selected_neighborhood || @selected_category, 
                                     @group, 
                                     params[:page], 
                                     AJAX_POSTS_PER_PAGE, 
                                     params[:search]
                                     )

    respond_to do |format|
      format.js
    end
  end

  def show
    @person = @membership.person
    @account = @person.account(@membership.group)
    respond_to do |format|
      format.js
      format.html { redirect_to('/groups/' + @membership.group.id.to_s + '#memberships/' + @membership.id.to_s)}
{'fraction_non_alphanumeric': 0.09060955518945635, 'fraction_numerical': 0.0012355848434925864, 'mean_word_length': 2.1918528252299607, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3618108', 'n_tokens_mistral': 694, 'n_tokens_neox': 644, 'n_words': 128}