How to find an active record that only has 1 association

stackjlei Source

Foo has many Bars - how do I find a Foo that only has 1 Bar

Foo.where(bars_count == 1).limit(1) only gives me a Active Record Relation instead of a Foo

ruby-on-railsactiverecord

Answers

comments powered by Disqus