title: How to loop through values and linking to them using Rails and Haml
body: <p>I have two models, Downtowns and Properties. The relationship is one-to-many, one downtown, many properties. I'm having trouble displaying and linking to a list of each downtown's properties on the downtown's show page.</p>
  
  <p>Instead of an actual link to each property, I'm getting HTML text instead, displayed in what would almost appear to be a string, but no executable path. </p>
  
  <p>Instead of getting <code>downtown property 1</code> as a link, I get: </p>
  
  <pre><code>&lt;a href="/downtowns/1/properties/1"&gt;downtown property 1&lt;/a&gt;
  </code></pre>
  
  <p>My route file is:</p>
  
  <pre><code>resources :downtowns do
      resources :properties
    end
  </code></pre>
  
  <p>My downtown controller is:</p>
  
  <pre><code>def show
      @properties = Property.where(downtown: @downtown_id)
    end
  
    def new
      @downtown = Downtown.new
    end
  
    def create
      @downtown = Downtown.create(downtown_params)
      if @downtown.save
        redirect_to @downtown
      else
        render 'new'
      end
    end
  
    def downtown_params
      params.require(:downtown).permit(:name, :city)
    end
  </code></pre>
  
  <p>My properties controller is:</p>
  
  <pre><code>  def new
      @property = Property.new
    end
  
    def create
      @downtown = property.find(id)
      @property = Property.create(params[:property_params])
      @property.downtown_id = @downtown.id
  
      if @property.save
        redirect_to @property
      else
        render 'new'
      end
    end
  
    def show
    end
  </code></pre>
  
  <p>And finally my downtown show page:</p>
  
  <pre><code>%h2= @downtown.name
  
  - if @downtown.properties.present?
    %p 
      = @downtown.properties.map {|property| link_to(property.name, downtown_property_path(property)) }.join("&lt;br/&gt;")
  - else
    No downtowns for now. 
  </code></pre>