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

  def create
    clean_up = CleanUp.new(clean_up_params)
    clean_up.referential = @referential
    if clean_up.valid?
      clean_up.save
    else
      flash[:alert] = clean_up.errors.full_messages.join("<br/>")
    end
    redirect_to referential_path(@referential)
  end

  def clean_up_params
    params.require(:clean_up).permit(:date_type, :begin_date, :end_date)
  end
end