Ruby on Rails table relationship
<p>I have a <code>product</code> table where it list down all the products user created. In product table there is <code>country</code> which indicate the product origin. Now to make the product country visible, the user table must have <code>merchant status</code> of 1. </p>

<p>Following code is use to pull the countries from product table:</p>

<pre><code>@countries = Product.select(:country).distinct.where("country is not null and country &lt;&gt; ''").pluck(:country)
</code></pre>

<p>Product Model:</p>

<pre><code>class Product &lt; ActiveRecord::Base
belongs_to :user
end
</code></pre>

<p>User Model:</p>

<pre><code>class User &lt; ActiveRecord::Base
has_many :products
end
</code></pre>

<p>How can I modified the above code, so it will include <code>merchant_status</code> in user table? Means I need list down countries only if <code>merchant_status = 1</code> in User table. Thanks!!</p>