1
我有一個籃球應用程序,有多對多的關係,一個教練可以指導多個球隊,一個球隊可以有很多教練。Rails 3.2.x未定義方法'加入'
Coaches_Controller.rb
def index
@coaches = Coach.joins(:teams).select("coaches.first_name, coaches.last_name, teams.team_level")
respond_to do |format|
format.html # index.html.erb
format.json { render json: @coaches }
end
end
Index.html.erb
<% @coaches.each do |coach| %>
<tr>
<td><%= link_to coach.first_name, coach_path(coach) %></td>
<td><%= coach.last_name %></td>
<td><%= coach.team_level %></td>
<td>
<%= link_to t('.edit', :default => t("helpers.links.edit")),
edit_coach_path(coach), :class => 'btn btn-mini' %>
<%= link_to t('.destroy', :default => t("helpers.links.destroy")),
coach_path(coach),
:method => :delete,
:confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?')),
:class => 'btn btn-mini btn-danger' %>
</td>
</tr>
<% end %>
我得到這個錯誤,我不明白爲什麼...
http://i.stack.imgur.com/5a6oB.png
想法?我覺得這是小事我沒有看到......謝謝!
ahhh小提琴棒,我知道這是容易我看了。謝謝你讓我感覺自己很笨拙;夥計 – mrcolombo 2012-04-26 03:51:49