class JeraPush::DeviceFilter

Attributes

field[RW]
message_id[RW]
platform[RW]
resource_name[RW]
value[RW]

Public Instance Methods

Private Instance Methods

search_with_value_field(scope) click to toggle source
# File lib/jera_push/models/device_filter.rb, line 27
def search_with_value_field(scope)
  if field.to_sym == :token
    return scope.where('jera_push_devices.token like ?', "%#{value}%")
  elsif JeraPush.resource_attributes.include?(field.to_sym)
    return scope.where("#{resource_name.constantize.table_name}.#{field} like ?", "%#{value}%")
  end
  return scope
end