and in oneliner
```ruby
 Puppetclass.where(:id => ConfigGroupClass.where(:config_group_id => config_group_ids).select(:puppetclass_id))
```