Last active
March 9, 2017 09:29
-
-
Save arnaudbesnier/f78dc852c25d4133bb23f6ff82df92fd to your computer and use it in GitHub Desktop.
Example of a Forest Segment Field on Rails
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# lib/forest_liana/collections/bot.rb | |
class Forest::Bot | |
include ForestLiana::Collection | |
collection :bots | |
segment 'expressive bots' do | |
{ id: Bot | |
.joins(:expressions) | |
.group('bots.id') | |
.having('count(expressions.id) > 10') | |
.map(&:id) } | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment