Module: ObjectJSONMapper::Local::ClassMethods
- Defined in:
- lib/object_json_mapper/local.rb
Instance Method Summary collapse
-
#find_by_local(source, &scope) ⇒ ObjectJSONMapper:Relation
Allows you to apply filters from local model to remote data.
- #local ⇒ Object
Instance Method Details
#find_by_local(source, &scope) ⇒ ObjectJSONMapper:Relation
Allows you to apply filters from local model to remote data.
47 48 49 50 51 52 53 54 55 |
# File 'lib/object_json_mapper/local.rb', line 47 def find_by_local(source, &scope) source.where( id_in: source.klass .local .all .instance_exec(&scope) .pluck(:id) ) end |
#local ⇒ Object
19 20 21 22 23 24 |
# File 'lib/object_json_mapper/local.rb', line 19 def local return @local if @local @local = Class.new(ActiveRecord::Base) @local.table_name = name.underscore.pluralize @local end |