Sha256: e5b707f28e4d22a1cde066d5df40a7ca64809345e327abc902925e9397d2ae2a

Contents?: true

Size: 1 KB

Versions: 5

Compression:

Stored size: 1 KB

Contents

class Census::DataGroupsController < ApplicationController
  
  def index
    @data_groups = DataGroup.all(:order => :position)
  end

  def new
    @data_group = DataGroup.new(params[:data_group])
  end
  
  def create
    @data_group = DataGroup.new(params[:data_group])
    
    if @data_group.save
      flash[:notice] = "Created #{@data_group.name}"
      redirect_to census_admin_path
    else
      render :action => 'new', :status => :unprocessable_entity
    end
  end
  
  def edit
    @data_group = DataGroup.find(params[:id])
  end
  
  def update
    @data_group = DataGroup.find(params[:id])
    
    if @data_group.update_attributes(params[:data_group])
      flash[:notice] = "Saved #{@data_group.name}"
      redirect_to census_admin_path
    else
      render :action => 'edit', :status => :unprocessable_entity
    end
  end
  
  def destroy
    @data_group = DataGroup.find(params[:id])
    @data_group.destroy
    flash[:notice] = "Deleted #{@data_group.name}"
    redirect_to census_admin_path
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
census-0.3.1 app/controllers/census/data_groups_controller.rb
census-0.3.0 app/controllers/census/data_groups_controller.rb
census-0.2.1 app/controllers/census/data_groups_controller.rb
census-0.2.0 app/controllers/census/data_groups_controller.rb
census-0.1.0 app/controllers/census/data_groups_controller.rb