Open ovi-tsb opened 5 years ago
What is the rest of your controller code?
What I did, is in the controller define a default scope. So for example in the Filterrific demo, Student with a default scope of for example freshman
(making it up):
def index
(@filterrific = initialize_filterrific(
Student.freshman,
params[:filterrific],
select_options: {
sorted_by: Student.options_for_sorted_by,
with_country_id: Country.options_for_select,
},
)) || return
@students = @filterrific.find.page(params[:page])
respond_to do |format|
format.html
format.js
end
end
Hopefully, this is the correct approach...?
I have in my jobs_controller
def index @jobs = Job.jobs_by(current_user)
and in job.rb model
scope :jobs_by, ->(user) { where(user_id: user.id) }
This should let users to see only jobs what they created, but now it show me jobs from all users. Do you think is something in filterrific what can cancel
Job.jobs_by(current_user)
?