I want the Link text on my view to display as Hospital, Country. Country is a guidelines attribute so I need to be able to access guidelines.country from 'hospital' and display it
e.g. Get Well Hospital, Sickland
I'm not sure how to code this correctly. At the moment in my view file I have
<% @list.each do |hospital| %>
<tr class="tablerow">
<td><%= link_to (hospital, country), :action => :topichospital, :hospital => hospital, :country=>country %></td>
</tr>
It worked when I just had, but I'm not sure how to add the country too
<% @list.each do |hospital| %>
<tr class="tablerow">
<td><%= link_to hospital, :action => :topichospital, :hospital => hospital %></td>
</tr>
my listhospital action in guidelines_controller.rb is
def listhospital
@list = Guideline.order(:hospital).uniq.pluck(:hospital)
respond_to do |format|
format.html # index.html.erb
format.json { render json: @guidelines }
end
end
countryvariable coming from? It's probably not stored in@listas i'm guessing that@listis just an array of hospital names.