每当gem

时间:2017-02-24 13:27:39

标签: ruby-on-rails ruby-on-rails-5

我有一个胜利者控制器,有一个

before_action :set_winners
  def create

    Winner.create(
    date: Time.now,
    likes: winner.selfy.likes_count,
    user_id: winner.user.id,
    selfy_id: winner.selfy.id
    )
  end
private

def set_winners
  date = DateTime.now.utc
  likes = Like.where('created_at >= ? and created_at <= ?', 2.week.ago.beginning_of_week, 1.week.ago.end_of_week).select(:selfy_id)
  top = Selfy.where(id: likes)
  top.order("COALESCE(likes_count, 0) DESC").limit(1)
end

我希望每5分钟执行一次,我会尝试使用像这样的宝石

every 2.minutes do
#   command "/usr/bin/some_great_command"
   runner "Winner.create"
#   rake "some:great:rake:task"
 end

我收到此错误

/bin/bash: bundle: command not found
/bin/bash: bundle: command not found
/bin/bash: bundle: command not found
/bin/bash: bundle: command not found
/bin/bash: bundle: command not found
/bin/bash: bundle: command not found

我在这里做错了什么。

2 个答案:

答案 0 :(得分:1)

尝试添加

  env :PATH, ENV['PATH'] 

到schedule.rb文件的顶部。

答案 1 :(得分:0)

尝试添加

env :PATH, ENV['PATH']
env :GEM_PATH, ENV['GEM_PATH']