Class: Admin::SmsOnRails::PhoneCarriersController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/admin/sms_on_rails/phone_carriers_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject

POST /admin/sms/phone_carriers POST /admin/sms/phone_carriers.xml



42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'app/controllers/admin/sms_on_rails/phone_carriers_controller.rb', line 42

def create
  @phone_carrier = SmsOnRails::PhoneCarrier.new(params[:phone_carrier])

  respond_to do |format|
    if @phone_carrier.save
      flash[:notice] = 'PhoneCarrier was successfully created.'
      format.html { redirect_to(sms_phone_carrier_url(:id => @phone_carrier)) }
      format.xml  { render :xml => @phone_carrier, :status => :created, :location => @phone_carrier }
    else
      format.html { render :action => "new" }
      format.xml  { render :xml => @phone_carrier.errors, :status => :unprocessable_entity }
    end
  end
end

#destroyObject

DELETE /admin/sms/phone_carriers/1 DELETE /admin/sms/phone_carriers/1.xml



76
77
78
79
80
81
82
83
84
# File 'app/controllers/admin/sms_on_rails/phone_carriers_controller.rb', line 76

def destroy
  @phone_carrier = SmsOnRails::PhoneCarrier.find(params[:id])
  @phone_carrier.destroy

  respond_to do |format|
    format.html { redirect_to(sms_phone_carriers_url) }
    format.xml  { head :ok }
  end
end

#editObject

GET /admin/sms/phone_carriers/1/edit



36
37
38
# File 'app/controllers/admin/sms_on_rails/phone_carriers_controller.rb', line 36

def edit
  @phone_carrier = SmsOnRails::PhoneCarrier.find(params[:id])
end

#indexObject

GET /admin/sms/phone_carriers GET /admin/sms/phone_carriers.xml



4
5
6
7
8
9
10
11
# File 'app/controllers/admin/sms_on_rails/phone_carriers_controller.rb', line 4

def index
  @phone_carriers = SmsOnRails::PhoneCarrier.all :group => :name

  respond_to do |format|
    format.html # index.html.erb
    format.xml  { render :xml => @phone_carriers }
  end
end

#newObject

GET /admin/sms/phone_carriers/new GET /admin/sms/phone_carriers/new.xml



26
27
28
29
30
31
32
33
# File 'app/controllers/admin/sms_on_rails/phone_carriers_controller.rb', line 26

def new
  @phone_carrier = SmsOnRails::PhoneCarrier.new

  respond_to do |format|
    format.html # new.html.erb
    format.xml  { render :xml => @phone_carrier }
  end
end

#showObject

GET /admin/sms/phone_carriers/1 GET /admin/sms/phone_carriers/1.xml



15
16
17
18
19
20
21
22
# File 'app/controllers/admin/sms_on_rails/phone_carriers_controller.rb', line 15

def show
  @phone_carrier = SmsOnRails::PhoneCarrier.find(params[:id])

  respond_to do |format|
    format.html # show.html.erb
    format.xml  { render :xml => @phone_carrier }
  end
end

#updateObject

PUT /admin/sms/phone_carriers/1 PUT /admin/sms/phone_carriers/1.xml



59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'app/controllers/admin/sms_on_rails/phone_carriers_controller.rb', line 59

def update
  @phone_carrier = SmsOnRails::PhoneCarrier.find(params[:id])

  respond_to do |format|
    if @phone_carrier.update_attributes(params[:phone_carrier])
      flash[:notice] = 'PhoneCarrier was successfully updated.'
      format.html { redirect_to(sms_phone_carrier_url(:id => @phone_carrier)) }
      format.xml  { head :ok }
    else
      format.html { render :action => "edit" }
      format.xml  { render :xml => @phone_carrier.errors, :status => :unprocessable_entity }
    end
  end
end