Created
April 15, 2011 13:31
-
-
Save Znow/921685 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class EmployeesController < ApplicationController | |
| def index | |
| @employees = Employees.all | |
| end | |
| # GET /employees/1 | |
| # GET /employees/1.xml | |
| #def show | |
| # @employee = Employee.find(params[:id]) | |
| #respond_to do |format| | |
| # format.html # show.html.erb | |
| #format.xml { render :xml => @employee } | |
| #end | |
| #end | |
| # GET /employees/new | |
| # GET /employees/new.xml | |
| def new | |
| @employees = Employees.new | |
| end | |
| # GET /employees/1/edit | |
| def edit | |
| @employees = Employees.find(params[:id]) | |
| end | |
| # POST /employees | |
| # POST /employees.xml | |
| def create | |
| @employees = Employees.new(params[:employees]) | |
| if @employees.save | |
| redirect_to employees_path | |
| else | |
| render :new | |
| end | |
| end | |
| # PUT /employees/1 | |
| # PUT /employees/1.xml | |
| def update | |
| @employees = Employees.find(params[:id]) | |
| respond_to do |format| | |
| if @employees.update_attributes(params[:employees]) | |
| format.html { redirect_to(@employees, :notice => 'Employee was successfully updated.') } | |
| format.xml { head :ok } | |
| else | |
| format.html { render :action => "edit" } | |
| format.xml { render :xml => @employees.errors, :status => :unprocessable_entity } | |
| end | |
| end | |
| end | |
| # DELETE /employees/1 | |
| # DELETE /employees/1.xml | |
| def destroy | |
| @employees = Employees.find(params[:id]) | |
| @employees.destroy | |
| respond_to do |format| | |
| format.html { redirect_to(employees_url) } | |
| format.xml { head :ok } | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment