diff --git a/app/controllers/employers_controller.rb b/app/controllers/employers_controller.rb index 1518fe3..e8dfa31 100644 --- a/app/controllers/employers_controller.rb +++ b/app/controllers/employers_controller.rb @@ -3,7 +3,7 @@ class EmployersController < ApplicationController # GET /employers def index - @employers = Employer.order(:name) + @employers = Employer.order(:last_name) end # GET /employers/:id diff --git a/app/models/employer.rb b/app/models/employer.rb index 91bccd1..8bacad4 100644 --- a/app/models/employer.rb +++ b/app/models/employer.rb @@ -2,5 +2,10 @@ class Employer < ApplicationRecord has_many :participants has_many :workers, through: :participants # Association with Vendor if needed + + def full_name + "#{first_name} #{last_name}" + end + end \ No newline at end of file diff --git a/app/views/employers/_form.html.erb b/app/views/employers/_form.html.erb index 82b61ce..ca171a0 100644 --- a/app/views/employers/_form.html.erb +++ b/app/views/employers/_form.html.erb @@ -11,8 +11,13 @@ <% end %>
Name | +First Name | +Last Name | Address | Phone | |
---|---|---|---|---|---|
<%= employer.name %> | +<%= employer.first_name %> <%= employer.last_name %> | <%= employer.address %> | <%= employer.phone %> | <%= employer.email %> | diff --git a/app/views/employers/show.html.erb b/app/views/employers/show.html.erb index f0e76dc..fc21542 100644 --- a/app/views/employers/show.html.erb +++ b/app/views/employers/show.html.erb @@ -7,7 +7,7 @@