title: Creating Submodels in Rails
body: <p>Hi I have a rails association question. I am building an equipment management app and I am having trouble determining the design of the model associations. </p>
  
  <p>So a user can create an Asset which has :make, :model, :year, :location, and other common attributes including :asset_type. The asset type could be a number of different types of equipment such as dozer, bus, engine, excavator, tender, etc. </p>
  
  <p>I had considered using STI but the asset types do not share the same attributes. What I am leaning towards is making a separate model for each asset type that would belong_to :asset and then accept_nested_params for each asset type in the Asset model so that I can create them in the same form using javascript to show an asset_type partial once the user chooses :asset_type from a select field. Then to access it I would need to do something like: </p>
  
  <pre><code>def show
    @asset = Asset.find(params[:id)
    @asset_type = @asset.asset_type.classify.constantize.find(params[@asset.id])
  end
  </code></pre>
  
  <p>This feels wrong to me. It seems to me that this would be very common situation and maybe I am just missing something very obvious.</p>
  
  <p>Any advice is appreciated.</p>