Module: Keinaufwand::Sync::RelationMethods
- Defined in:
- lib/keinaufwand/sync_core/record.rb
Instance Method Summary collapse
Instance Method Details
#order(*args) ⇒ Object
393 394 395 396 397 |
# File 'lib/keinaufwand/sync_core/record.rb', line 393 def order(*args) return super unless keinaufwand_record_relation? && args.any? && args.all? { |arg| klass.json_order_argument?(arg) } super(Arel.sql(args.flat_map { |arg| klass.json_order_sql(arg) }.join(", "))) end |
#where(*args) ⇒ Object
385 386 387 388 389 390 391 |
# File 'lib/keinaufwand/sync_core/record.rb', line 385 def where(*args) return super unless keinaufwand_record_relation? && args.first.is_a?(Hash) && klass.json_hash_conditions?(args.first) json_conditions, column_conditions = klass.split_json_conditions(args.first) relation = column_conditions.any? ? super(column_conditions, *args[1..]) : self klass.apply_json_conditions(relation, json_conditions) end |