Skip to content

Instantly share code, notes, and snippets.

@lappi-lynx
Created January 29, 2016 12:20
Show Gist options
  • Save lappi-lynx/a415cf3fbac941e3e1f0 to your computer and use it in GitHub Desktop.
Save lappi-lynx/a415cf3fbac941e3e1f0 to your computer and use it in GitHub Desktop.
Rails: Convert array into ActiveRecord Relation object
scope :with_scope, -> { where(id: ARRAY_COLLECTION.map(&:id)) }
@prateekvyas2121
Copy link

this gives
(byebug) Offer.where(id: offers.map(&:id)) *** NameError Exception: uninitialized constant ActionView::CompiledTemplates::Offer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment