Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <h2>Add A New Employee</h2>
- <% form_for :employee, @employee, :url => :create do |f| %>
- <h3>Basic Information</h3>
- <p><em>First Name:</em> <%= f.text_field :first_name %></p>
- <p><em>Last Name:</em> <%= f.text_field :last_name %></p>
- <p><em>Username:</em> <%= f.text_field :username %></p>
- <p><em>Password:</em> <%= f.password_field :password %></p>
- <p><em>Confirm:</em> <%= f.password_field :password_confirmation %></p>
- <p>Manager? <%= f.check_box :manager %>
- <h3>Work Details</h3>
- <p><em>Start Time:</em> <%= f.text_field :start_time %></p>
- <p>Lunch Time: <%= f.text_field :lunch_time %></p>
- <p>Daily Lunch Hours: <%= f.text_field :daily_lunch_hours %></p>
- <p><em>Weekly Regular Hours:</em> <%= f.text_field :weekly_regular_hours %></p>
- <p>Annual Vacation Hours: <%= f.text_field :annual_vacation_hours %></p>
- <p>Annual Personal Hours: <%= f.text_field :annual_personal_hours %></p>
- <p>Annual Sick Hours: <%= f.text_field :annual_sick_hours %></p>
- <%= submit_tag "Create Employee Record" %>
- <% end %>
- class EmployeesController < ApplicationController
- before_filter :authenticate
- before_filter :manager_required
- def new
- @employee = Employee.new
- end
- def create
- @employee = Employee.new(params[:employee])
- if @employee.save
- flash[:notice] = "Employee was saved sucessfully"
- redirect_to :controller => :manager
- else
- render :action => "new"
- end
- end
- end
Add Comment
Please, Sign In to add comment