Using http://github.com/collectiveidea/delayed_job
It says:
Call
.delay.method(params)
on any object and it will be processed in the background.Notifier.delay.deliver_signup @user
If I start a brand new Rails project, and create a scaffold of story
, and use either:
class StoriesController < ApplicationController
def index
@stories = Story.all
Kernel.delay.puts "hello"
end
Or
class StoriesController < ApplicationController
def self.print_something
puts "hello"
end
def index
@stories = Story.all
StoriesController.delay.print_something
end
It won't work? I thought delay can delay the execution of the code? The error is
undefined method 'delay' for StoriesController:Class