Created
September 30, 2015 06:13
-
-
Save kazasiki/3fa123eb2bdb0f3e3b65 to your computer and use it in GitHub Desktop.
[Rails]ActiveJobからurl_helperを呼ぶ ref: http://qiita.com/kazasiki/items/69e5318c662a60536939
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BaseJob < ActiveJob::Base | |
include Rails.application.routes.url_helpers | |
protected | |
def default_url_options | |
{ host: ENV['HOST_NAME'] } | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class HogeJob < BaseJob | |
queue_as :default | |
def perform(*args) | |
# something | |
# foobar_urlが呼べる | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment