Basis of rails-driven app for local business
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
 
 
 
 
 

44 lines
928 B

class EmployeesController < ApplicationController
def index
@employees = Employee.all
end
def show
@employee = Employee.find(params[:id])
end
def new
@employee = Employee.new
end
def create
@employee = Employee.new(params[:employee])
if @employee.save
flash[:notice] = "Successfully created record."
redirect_to employees_url
else
render :action => 'new'
end
end
def edit
@employee = Employee.find(params[:id])
end
def update
@employee = Employee.find(params[:id])
if @employee.update_attributes(params[:employee])
flash[:notice] = "Successfully updated record."
redirect_to employees_url
else
render :action => 'edit'
end
end
def destroy
@employee = Employee.find(params[:id])
@employee.destroy
flash[:notice] = "Successfully destroyed employee."
redirect_to employees_url
end
end