Last active
June 3, 2017 10:19
-
-
Save mh-github/5a1aa2e64b58d17b5b3656f5ae5ca068 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
| # controller code | |
| def index | |
| @paginatable_employees = Kaminari.paginate_array(Employee.all).page(params[:page]).per(10) | |
| end | |
| # view code. filename : index.html.erb | |
| <table> | |
| <thead> | |
| <tr> | |
| <th>Emp No</th> | |
| <th>Name</th> | |
| <th>Qualifications</th> | |
| <th>Joining Date</th> | |
| <th>Division</th> | |
| <th>Department</th> | |
| <th>Designation</th> | |
| <th>email</th> | |
| <th>Phone 1</th> | |
| <th>Phone 2</th> | |
| <th>Manager Emp No</th> | |
| <th colspan="3"></th> | |
| </tr> | |
| </thead> | |
| <tbody> | |
| <%= paginate @paginatable_employees %> | |
| <% @paginatable_employees.each do |emp| %> | |
| <tr> | |
| <td><%= emp.emp_no %></td> | |
| <td><%= emp.name %></td> | |
| <td><%= emp.qualifications %></td> | |
| <td><%= emp.joining_date %></td> | |
| <td><%= emp.division %></td> | |
| <td><%= emp.department %></td> | |
| <td><%= emp.designation %></td> | |
| <td><%= emp.email %></td> | |
| <td><%= emp.phone_1 %></td> | |
| <td><%= emp.phone_2 %></td> | |
| <td><%= emp.manager_emp_no %></td> | |
| <td><%= link_to 'Show', emp %></td> | |
| <td><%= link_to 'Edit', edit_employee_path(emp) %></td> | |
| <td><%= link_to 'Destroy', emp, method: :delete, data: { confirm: 'Are you sure?' } %></td> | |
| </tr> | |
| <% end %> | |
| </tbody> | |
| </table> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment