summaryrefslogtreecommitdiff
path: root/app/controllers/sim_card_providers_controller.rb
blob: e9a019c2c6e7b310702be7ba58650538b0fbad09 (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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
class SimCardProvidersController < ApplicationController
  load_and_authorize_resource :sim_card_provider
  before_filter :spread_breadcrumbs

  def index
  end

  def show
  end

  def new
  end

  def create
    if @sim_card_provider.save
      redirect_to @sim_card_provider, :notice => t('sim_card_providers.controller.successfuly_created')
    else
      render :new
    end
  end

  def edit
  end

  def update
    if @sim_card_provider.update_attributes(params[:sim_card_provider])
      redirect_to @sim_card_provider, :notice  => t('sim_card_providers.controller.successfuly_updated')
    else
      render :edit
    end
  end

  def destroy
    @sim_card_provider.destroy
    redirect_to sim_card_providers_url, :notice => t('sim_card_providers.controller.successfuly_destroyed')
  end

  private

  def spread_breadcrumbs
    add_breadcrumb t("sim_card_providers.index.page_title"), sim_card_providers_path
    if @sim_card_provider && !@sim_card_provider.new_record?
      add_breadcrumb @sim_card_provider, sim_card_provider_path(@sim_card_provider)
    end
  end

end