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

  belongs_to :referential do
    belongs_to :line, :parent_class => Chouette::Line do
      belongs_to :route, :parent_class => Chouette::Route do
        belongs_to :vehicle_journey, :parent_class => Chouette::VehicleJourney
      end
    end
  end

  def create
    begin
      translation = VehicleTranslation.new( params[:vehicle_translation].merge( :vehicle_journey_id => parent.id))
      translation.translate
      flash[:notice] = t('vehicle_translations.success', :count => translation.count)
    rescue
      flash[:alert] = t('vehicle_translations.failure')
    end
    redirect_to referential_line_route_vehicle_journeys_path(@referential, @line, @route)

  end
  
end