简体   繁体   English

如何从印象派的轨道获取时间范围?

[英]how to get time range from impressionist rails?

I know this is hard but ... I am trying to count views for impressionist gem on a specific time from date of last post till time.now and the code below doesn't seem to work as this message appear ? 我知道这很难,但是...我正试图计算从上次发布日期到time.now在特定时间的impressionist gem观看impressionist gem ,并且由于此消息的出现,下面的代码似乎不起作用?

wrong number of arguments (given 0, expected 1..2) 参数数目错误(给定0,应为1..2)

<%= @user.impressionist_count(:filter=>:ip_address, :start_date=>"#{current_user.posts.last.created_at.strftime("%Y-%m-%d")}", :end_date=>"#{t.strftime("%Y-%m-%d")}") %>

post controller : 后控制器:

def show
  @user = current.user
  @post = Post.new
end

user model : 用户模型:

is_impressionable
has_many posts

This should work properly. 这应该正常工作。

<%= @user.impressionist_count(:filter => :ip_address, :start_date => 
current_user.posts.last.created_at.strftime('%Y-%m-%d'), :end_date => 
t.strftime('%Y-%m-%d')) %>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM