aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/clean_ups_controller.rb
blob: fde015efd577a2656973dbe66aa0cf862f97f424 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
class CleanUpsController < ChouetteController
  respond_to :html, :only => [:create]

  belongs_to :referential 

  def create
    clean_up = CleanUp.new( params[:clean_up])
    if clean_up.invalid?
      flash[:alert] = clean_up.errors.full_messages.join("<br/>")
    else
      begin
        result = clean_up.clean
        flash[:notice] = result.notice.join("<br/>")
      rescue
        flash[:alert] = t('clean_ups.failure') + $!
      end
    end
    redirect_to referential_path(@referential)

  end
  
end