title: Rails concatenate sql columns and create one to many relationship
body: <p>I've got two models: <code>Building</code> and <code>BuildingInfo</code>. I want to relate the two tables using two columns <code>townhall_level</code> and <code>name</code>.</p>
  
  <p>Ideally it will work like the following: <code>Building.first.building_info</code> For instance <code>Building.first.townhall_level =&gt; 5</code> and <code>Building.first.name =&gt; cannon</code>, <code>Building.first.building_info</code> would access <code>BuildingInfo.where(townhall_level: 5, name:"cannon"</code>.</p>
  
  <p>What's the best way to do this? Can I create a third column which concatenates <code>name</code> and <code>townhall_level</code>? Could I also use that column to create the belongs_to and has_many relationship?</p>