尊敬的人...
我对rails真的很陌生,所以我需要你的宝贵帮助......
我的数据库中有一个名为“graph_hospital_vacant_by_band”的数据库视图
mysql> desc graph_hospital_vacant_by_band;
+-------------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------------------+--------------+------+-----+---------+-------+
| specialisation_id | int(11) | NO | | NULL | |
| specialisation | varchar(255) | YES | | NULL | |
| nos | bigint(21) | NO | | 0 | |
| hospitalband | varchar(255) | NO | | NULL | |
+-------------------+--------------+------+-----+---------+-------+
4 rows in set (0.00 sec)
其型号为:
class GraphHospitalVacantByBand < ActiveRecord::Base
self.table_name = 'graph_hospital_vacant_by_band'
end
控制器如下:
class GraphHospitalVacantByBandsController < InheritedResources::Base
end
视图如下:
<table class="table table-bordered">
<thead>
<tr>
<th>Specialisation</th>
<th>No.</th>
<th>Hospital Band</th>
</tr>
</thead>
<tbody>
<% @graph_hospital_vacant_by_bands.each do |graph_hospital_vacant_by_band| %>
<tr>
<td><%= graph_hospital_vacant_by_band.specialisation %></td>
<td><%= graph_hospital_vacant_by_band.nos %></td>
<td><%= graph_hospital_vacant_by_band.hospitalband %></td>
</tr>
<% end %>
</tbody>
</table>
目前显示这个
http://i.stack.imgur.com/v7Jwt.png
我需要一个带有可用专业的下拉列表,以便在选择特定专业时显示该专业的 nos,hospitalband ...
我环顾四周并进行了很多实验,但徒劳无功....
我不知道我应该如何更新我的模型和控制器来处理传递的参数....
非常感谢...
真诚的问候-天空