Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# app/models/my_model.rb
def self.ransackable_scopes(_auth_object = nil)
%i[activated_in_period_gteq_datetime activated_in_period_lteq_datetime]
end
def self.activated_in_period_gteq_datetime(date_from)
joins(:user).where('users.activation_date >= ?', date_from)
end
def self.activated_in_period_lteq_datetime(date_to)
joins(:user).where('users.activation_date <= ?', date_from)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment