aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/clean_ups_controller.rb
blob: 1e483577519cd5350bb4dc21bea3e5f957650d86 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
class CleanUpsController < ChouetteController
  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(:keep_lines, :keep_stops, :keep_companies, :keep_networks, :keep_group_of_lines, :begin_date, :end_date)
  end
end