class ReviewsController < ApplicationController
  layout "water"
  respond_to :html

  def grade
	  if current_role.is_a?(Assistant) or current_role.is_a?(Examiner)
	    @submission = Submission.find(params[:id])
      if can?(:grade, @submission)
	      @submission.lab_has_group.update_attribute(:grade,params[:grade])
      end
	  end
    redirect_to labs_path, notice: "Grade was change on submission"
 	end

  def state
    if current_role.is_a?(Assistant) or current_role.is_a?(Examiner)
      if can?(:state, @submission)
        Submission.find(params[:id]).lab_has_group.send("#{params[:state]}!")
      end
    end  
    respond_with(@submission)
  end
end
class ReviewsController < ApplicationController
  layout "water"
  respond_to :html


  def review
    result = params[:result]
    submission = Submission.find(result[:id])

    if result[:grade]
      if can?(:grade, @submission)
        @submission.lab_has_group.update_attribute(:grade,result[:grade])
      end
     redirect_to labs_path, notice: "Grade was changed on submission"
    end

    if result[:state]
      if can?(:state, @submission)
        Submission.find(submission).lab_has_group.send("#{result[:state]}!")
      end
    end  

    respond_with(@submission)
  end
end
Replace grade and state methods with review method in review_controller
Replace grade and state methods with review method in review_controller
