Class: Dominium::CountriesController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/dominium/countries_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject

POST /dominium/countries POST /dominium/countries.json



28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'app/controllers/dominium/countries_controller.rb', line 28

def create
  @dominium_country = Dominium::Country.new(params[:dominium_country])

  respond_to do |format|
    if @dominium_country.save
      format.html { redirect_to @dominium_country, notice: 'Country was successfully created.' }
      format.json { render json: @dominium_country, status: :created, location: @dominium_country }
    else
      format.html { render action: "new" }
      format.json { render json: @dominium_country.errors, status: :unprocessable_entity }
    end
  end
end

#destroyObject

DELETE /dominium/countries/1 DELETE /dominium/countries/1.json



60
61
62
63
64
# File 'app/controllers/dominium/countries_controller.rb', line 60

def destroy
  @dominium_country = Dominium::Country.find(params[:id])
  @dominium_country.destroy
  redirect_to dominium_countries_path, notice: 'Country was sucessfuly deleted'
end

#editObject

GET /dominium/countries/1/edit



22
23
24
# File 'app/controllers/dominium/countries_controller.rb', line 22

def edit
  @dominium_country = Dominium::Country.find(params[:id])
end

#indexObject

GET /dominium/countries GET /dominium/countries.json



5
6
7
# File 'app/controllers/dominium/countries_controller.rb', line 5

def index
  @dominium_countries = Dominium::Country.all
end

#newObject

GET /dominium/countries/new GET /dominium/countries/new.json



17
18
19
# File 'app/controllers/dominium/countries_controller.rb', line 17

def new
  @dominium_country = Dominium::Country.new
end

#showObject

GET /dominium/countries/1 GET /dominium/countries/1.json



11
12
13
# File 'app/controllers/dominium/countries_controller.rb', line 11

def show
  @dominium_country = Dominium::Country.find(params[:id])
end

#updateObject

PUT /dominium/countries/1 PUT /dominium/countries/1.json



44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'app/controllers/dominium/countries_controller.rb', line 44

def update
  @dominium_country = Dominium::Country.find(params[:id])

  respond_to do |format|
    if @dominium_country.update_attributes(params[:dominium_country])
      format.html { redirect_to @dominium_country, notice: 'Country was successfully updated.' }
      format.json { head :ok }
    else
      format.html { render action: "edit" }
      format.json { render json: @dominium_country.errors, status: :unprocessable_entity }
    end
  end
end