I am using Ruby on Rails 3.2.2 and MySQL. After my previous question on "how to handle massive storage of records in database for user authorization purposes", since related answers (on how to solve the issue or how to accomplish to that I am looking for) aren't sufficiently detailed or require to much resources (at least for me), I would like to know what are valid and reasonable alternatives to that approach.
In few words, this question could be phrase as: how to handle "complex" (at level of SQL querying) user authorizations when you have to fetch more than one "authorized" records? That is, for example, given I have a readable_by_user?
method in my model class, how to retrieve more than one record (records could be 10 or billions of billions) by executing as few as possible SQL queries when you would use code like the following (note: the following code would be used mostly in index
controller actions):
Article.readable_by_user(@current_user)
# => Returns all articles readable by the current user.