How to query nested associations in rails
<p>My models are
campaign.rb</p>

<pre><code>has_many: views_logs
</code></pre>

<p>user.rb</p>

<pre><code>has_many :views_logs
</code></pre>

<p>views_log.rb</p>

<pre><code>belongs_to :campaign
belongs_to :user
</code></pre>

<p>I want to get <code>Campaign.first.views_logs.uniq.users.genders</code>
I know this query this is wrong but basically I want to get this</p>