<commit_before>class OrganizationsController < ApplicationController

  def index
    @organizations = Organization.paginate(:page => params[:page], :per_page => 10)
  end

  def new
    @organization = Organization.new
  end

  def create
    @organization = Organization.new(organization_params)
    respond_to do |format|
      if @organization.save
        @user = User.find(session[:user_id])
        @user.update(organization_id: @organization.id)
        format.html {redirect_to services_new_path, notice: 'Organization was successfully created.' }
      else
        format.html {render :new}
      end
    end
  end

  def show
    @organization = Organization.find(params[:id])
    @services = Service.where(organization: @organization.id).paginate(:page => params[:page], :per_page => 5)
  end

  private

  def organization_params
    params.require(:organization).permit(:name, :description)
  end
end<commit_msg>Streamline organization creation under the current user.<commit_after>class OrganizationsController < ApplicationController
  def index
    @organizations = Organization.paginate(:page => params[:page], :per_page => 10)
  end

  def new
    @organization = Organization.new
  end

  def create
    @organization = current_user.organizations.new(organization_params)
    respond_to do |format|
      if @organization.save
        format.html {redirect_to services_new_path, notice: 'Organization was successfully created.' }
      else
        format.html {render :new}
      end
    end
  end

  def show
    @organization = Organization.find(params[:id])
    @services = Service.where(organization: @organization.id).paginate(:page => params[:page], :per_page => 5)
  end

  private

  def organization_params
    params.require(:organization).permit(:name, :description)
  end
end
{'fraction_non_alphanumeric': 0.10005527915975677, 'fraction_numerical': 0.003316749585406302, 'mean_word_length': 3.738219895287958, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, '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': '3389530', 'n_tokens_mistral': 525, 'n_tokens_neox': 489, 'n_words': 125}