Sha256: 9a89eec749c574f30bd0e20c369e2122e5a61f759ed1b5ee48f24102d29f0dc1
Contents?: true
Size: 1.99 KB
Versions: 10
Compression:
Stored size: 1.99 KB
Contents
class CountriesController < ApplicationController has_crud_actions =begin # GET /countries # GET /countries.json def index @countries = Country.all respond_to do |format| format.html # index.html.erb format.json { render json: @countries } end end # GET /countries/1 # GET /countries/1.json def show @country = Country.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @country } end end # GET /countries/new # GET /countries/new.json def new @country = Country.new respond_to do |format| format.html # new.html.erb format.json { render json: @country } end end # GET /countries/1/edit def edit @country = Country.find(params[:id]) end # POST /countries # POST /countries.json def create @country = Country.new(params[:country]) respond_to do |format| if @country.save format.html { redirect_to @country, notice: 'Country was successfully created.' } format.json { render json: @country, status: :created, location: @country } else format.html { render action: "new" } format.json { render json: @country.errors, status: :unprocessable_entity } end end end # PUT /countries/1 # PUT /countries/1.json def update @country = Country.find(params[:id]) respond_to do |format| if @country.update_attributes(params[:country]) format.html { redirect_to @country, notice: 'Country was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @country.errors, status: :unprocessable_entity } end end end # DELETE /countries/1 # DELETE /countries/1.json def destroy @country = Country.find(params[:id]) @country.destroy respond_to do |format| format.html { redirect_to countries_url } format.json { head :no_content } end end =end end
Version data entries
10 entries across 10 versions & 1 rubygems