0

It's possible that I was never doing this properly, but it was working in Rails 3, and now that .scoped is gone it no longer works.

Essentially I have a field in the User table who's value is used to filter almost all other data in the app. In Rails 3 I was using current_user.field_name in the ApplicationController and created methods that used .scoped that were in turn used as before_filter in controllers.

Now that .scoped is gone I need a solution and it probably makes sense to figure out the right way to do this.

To summarize what I need to do:

I need to get a value based on a field for the currently logged in user and then filter a bunch of models based on that value. Is this possible and what is the proper way to do it?

2

1 Answer 1

1

You can use

.where(nil) 

as replacement

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.