2013-06-17 2 views
0

무슨 일 이니?레일 "레이크 작업"을 실행하는 방법

친구가 rake 작업을 만들어 데이터베이스에서 데이터를 업데이트했습니다 (db가 변경 되었기 때문에). 다음은 작업입니다 : 이미 내 로컬 호스트에서이 레이크 작업을 실행

namespace :db do 

    task :update_database => :environment do 
    puts "Update do banco" 

    posts = Post.where("source_id is null").order("id") 
    done = Array.new 
    posts.each do |post| 
     if post.source_id.nil? and !done.include?(post) 
     posts2 = Post.where("content LIKE ? AND id != ?", post.content, post.id) 
     done.concat(posts2) 
     posts2.each do |post2| 
      post2.source_id = post.id 
      post2.save 
     end 
     end 
    end 

    end 
end 

,하지만 난 Heroku가 내 프로젝트와 지금 내 프로젝트하지 않습니다 개방을 온라인으로 배포 할 수 있습니다. 갈퀴 작업을 수행 할 명령이 무엇인지 기억하지 못하고 어디에서도 찾을 수 없습니다.

내 질문은 다음과 같습니다 레이크 작업을 실행하는 명령은 무엇

  1. ?
  2. heroku에서 rake 작업을 실행하는 명령은 무엇입니까? 그냥 "헤로 쿠"하는거야?

고마워요!

답변

3
heroku run bundle exec rake db:update_database 

해야합니다.

bundle exec은 현재 묶음의 컨텍스트에서 스크립트가 실행되도록합니다.

+0

감사합니다. 작동합니다! – Paladini

+0

곧 최고의 답변을 드릴 것입니다 ... – Paladini

관련 문제