byCoder
byCoder

Reputation: 9184

Rebuild sphinx index in method

I have such method (i'm loading files to server):

def mymethod
****---****
flash[:notice] = "Price zagruzhen"
`rake ts:rebuild`
redirect_to admin_mainpage_path
end

and i need to update sphinx after some manipulations, but now i see that it's doesn't work, but why? if in console in folder i write rake ts:rebuild all is ok, but in method something is bad.

could i do this without doing task? And when i must use task, how to use it?

Also i use nginx+passenger and rails 3.2.8

Upvotes: 0

Views: 210

Answers (1)

hedgesky
hedgesky

Reputation: 3311

I think you could use this method

Rails.application.load_tasks
Rake::Task['ts:rebuild'].invoke

Upvotes: 1

Related Questions