Skip to content

Commit

Permalink
salary reject implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
dilumn committed May 24, 2022
1 parent 1718d46 commit 313a26a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/controllers/salaries_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ class SalariesController < ApplicationController
before_action :authenticate_user!, only: %i[vote_accurate vote_fake]

def index
@q = Salary.includes(:salary_votes).ransack(params[:q])
@q = Salary.includes(:salary_votes).where(status: 'approved').ransack(params[:q])
@salaries = @q.result.page(params[:page])
end

Expand Down
5 changes: 5 additions & 0 deletions app/models/salary.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ class Salary < ApplicationRecord
'more_than_500': 'More than 500'
}

enum status: {
approved: 'approved',
rejected: 'rejected'
}

has_many :salary_votes

def accurate_votes_count
Expand Down

0 comments on commit 313a26a

Please sign in to comment.