简体   繁体   中英

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 ?

wrong number of arguments (given 0, expected 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')) %>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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