I have two models in my Rails application, Users and Calls. The model associations are set as follows:
<>strong>user model
has_many :calls
<>唱名表决>
belongs_to :user
我正试图在申请中打上目前用户的电话数目。
Currently, I am using the following string:
<%= Call.count %>
哪些是行之有效的,但显然需要all<>>m>打电话,而不仅仅是现有用户发出的呼吁。
因此,我放弃了以下内容:
<%= current_user.Call.calls.count %>
我对如何做到这一点感到困惑。 我需要能够从任何地方打上计票,以便我能够根据过去30天等开始计算。