I have a situation where I need to select a larger set of records which
need to be iterated through. In this case we want to break after we find a
record that matches some logic condition.
If I do:
Model.where(field: value).limit(1000).each {|model| do_something }
It will instantiate an ActiveRecord model for all results even thought it's
possible to break after the first record.
We are currently using Rails 4.2.7.1
Is it possible to do this using ActiveRecord, or do I have work directly
with SQL.
Thanks,
Dan
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.