<commit_before>class CoursesController < ApplicationController
  before_filter :authenticate_user!
  before_filter :get_club, :only => [ :show_all ]
  before_filter :get_course, :only => [ :edit, :update, :change_logo ]

  def create
    @club = Club.find params[:club_id]
    @course = @club.courses.new

    authorize! :create, @course

    @course.assign_defaults
    @course.save

    render :edit
  end

  def edit
    authorize! :edit, @course

    @club = @course.club
  end

  def update
    authorize! :update, @course

    @course.update_attributes params[:course]

    respond_with_bip @course
  end

  def change_logo
    authorize! :update, @course
  end

  def show_all
    @courses = @club.courses
  end

  private

  def get_club
    @club = Club.find params[:club_id]
  end

  def get_course
    @course = Course.find params[:id]
  end
end
<commit_msg>Add upload_logo Action to Courses Controller<commit_after>class CoursesController < ApplicationController
  before_filter :authenticate_user!
  before_filter :get_club, :only => [ :show_all ]
  before_filter :get_course, :only => [ :edit, :update, :change_logo, :upload_logo ]

  def create
    @club = Club.find params[:club_id]
    @course = @club.courses.new

    authorize! :create, @course

    @course.assign_defaults
    @course.save

    render :edit
  end

  def edit
    authorize! :edit, @course

    @club = @course.club
  end

  def update
    authorize! :update, @course

    @course.update_attributes params[:course]

    respond_with_bip @course
  end

  def change_logo
    authorize! :update, @course
  end

  def upload_logo
    authorize! :update, @course

    if @course.update_attributes params[:course]
      redirect_to edit_course_path(@course)
    else
      render :change_logo, :formats => [ :js ]
    end
  end

  def show_all
    @courses = @club.courses
  end

  private

  def get_club
    @club = Club.find params[:club_id]
  end

  def get_course
    @course = Course.find params[:id]
  end
end

{'fraction_non_alphanumeric': 0.09509509509509509, 'fraction_numerical': 0.0, 'mean_word_length': 3.217299578059072, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 8, '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': '805496', 'n_tokens_mistral': 685, 'n_tokens_neox': 652, 'n_words': 169}