Class: Api::V1::EmployersController

Inherits:
ApiController
  • Object
show all
Defined in:
app/controllers/acts_as_talented/api/v1/employers_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



9
10
11
12
# File 'app/controllers/acts_as_talented/api/v1/employers_controller.rb', line 9

def index
  employers = Employer.paginate(page: params[:page] || 1 , per_page: params[:per_page] || 10)
  render json: [{ data: employers, count: Employer.all.size }], status: :ok
end

#updateObject



14
15
16
17
18
19
20
# File 'app/controllers/acts_as_talented/api/v1/employers_controller.rb', line 14

def update
	if @employer.update_attributes(update_params)
   render json: @employer, status: :ok
 else
   render json: { error: @employer.errors.full_messages.join(",") }, status: :unprocessable_entity
 end
end