Ruby on rails 引导手风琴不会在单击时展开
在accounts索引中,我想在表中显示我正在做的帐户信息,并在手风琴或dropwon中显示我的购买信息 我的账户模式是 结束 显示在其index.html.erb中Ruby on rails 引导手风琴不会在单击时展开,ruby-on-rails,twitter-bootstrap,accordion,Ruby On Rails,Twitter Bootstrap,Accordion,在accounts索引中,我想在表中显示我正在做的帐户信息,并在手风琴或dropwon中显示我的购买信息 我的账户模式是 结束 显示在其index.html.erb中 我想按行单击account.purchases展开,但我做得不对。这对您有用吗?实际上不,我隐藏的内容不是隐藏的!使用静态内容非常有效,但当我很抱歉的时候。你能更详细地描述出哪里出了问题吗? class Account < ActiveRecord::Base #Associations has_many :purcha
我想按行单击account.purchases展开,但我做得不对。这对您有用吗?实际上不,我隐藏的内容不是隐藏的!使用静态内容非常有效,但当我很抱歉的时候。你能更详细地描述出哪里出了问题吗?
class Account < ActiveRecord::Base
#Associations
has_many :purchases, dependent: :destroy do
def total
total = 0
self.each { |purchase| total += purchase.total }
total
end
end
has_many :sales, dependent: :destroy
has_many :payments, dependent: :destroy
#Validations
validates :name, presence: true
validates :category, presence: true
<div class="row table-responsive" style="margin-top:50px;">
<table id="accountstable"class="table table-striped custab tablesorter">
<thead>
<tr style="margin-bottom:20px;">
<%= link_to 'Add Account', new_account_path ,:class => "btn btn-primary btn-xs pull-center"%>
</tr>
<tr>
<th>Name</th>
<th>Category</th>
<th>Balance</th>
<th>Transactions</th>
</tr>
</thead>
<% @accounts.each do |account| %>
<tr>
<td><%= account.name %></td>
<td><%= account.category %></td>
<td><%= 0 + account.purchases.total %></td>
<td><%= link_to 'Edit', edit_account_path(account), :class=>"btn btn-info btn-xs" %></td>
<td><%= link_to 'Delete', account, method: :delete, data: { confirm: 'Sure ?' },:class=>"btn btn-danger btn-xs" %>
<% end %>
</table>
</div>