1  def prefer
 2    @problem = Problem.find_by_id params[:problem_id]
 3    @refactor = @problem.refactors.find params[:id]
 4
 5    event = PreferRefactor.new @problem, @refactor, @current_user
 6    if event.run!
 7      flash[:notice] = event.message
 8    else
 9      flash[:error] = event.message
10    end
11
12    redirect_to problem_path(@problem)
13  end

hi i want to make this better

posted Mar 25 at 17:32

this is stupid

1 Refactor


Preferred!

Shortest Code!

 1def prefer
 2    @problem = Problem.find_by_id params[:problem_id]
 3    @refactor = @problem.refactors.find params[:id]
 4
 5    event = Stuff.new @problem, @refactor, @current_user
 6    if event.run!
 7      flash[:notice] = event.message
 8    else
 9      flash[:error] = event.message
10    end
11
12    redirect_to problem_path(@problem)
13  end

isn't this btter

suggested Mar 25 at 17:33