title: 'has_one :through' association using namespaced classes
body: <p>I am using Ruby on Rails 3 and I am trying to use an <code>has_one :through</code> association using namespaced classes. I read the <a href="http://guides.rubyonrails.org/association_basics.html" rel="nofollow">official guide</a> about association models but I don't know how to accomplish that.</p>
  
  <p>I have <code>User</code>, <code>Relationship</code> and <code>Group</code>classes and <strong>I would like to associate <code>Users</code> and <code>Groups</code> through the <code>Relationship</code> class</strong>. As well, I would like to autosave related records and delete the relationship records on group or user deletion.</p>
  
  <p>My file system is:</p>
  
  <pre><code>app/models/users/user.rb
  app/models/users/relationship.rb
  app/models/users/group.rb
  </code></pre>
  
  <p>In <code>configs/routes.rb</code> I have</p>
  
  <pre><code>namespace :users do
    resources :users
    resources :relationship
    resources :groups
  end
  </code></pre>
  
  <p>Class (Model) statements are:</p>
  
  <pre><code>class Users::User &lt; ActiveRecord::Base
    ...
  end
  
  class Users::Relationship &lt; ActiveRecord::Base
    ...
  end
  
  class Users::Group &lt; ActiveRecord::Base
    ...
  end
  </code></pre>
  
  <p><strong>How I must write code associations in above model files? Have you some advice about?</strong></p>
  
  <hr>
  
  <p><strong>UPDATE</strong></p>
  
  <p>My Classes (Models) have these attributes:</p>
  
  <p><strong>User</strong></p>
  
  <p>id</p>
  
  <p>full_name</p>
  
  <p>...</p>
  
  <p><strong>Relationship</strong></p>
  
  <p>id</p>
  
  <p>user_id</p>
  
  <p>group_id</p>
  
  <p><strong>Group</strong></p>
  
  <p>id</p>
  
  <p>name</p>