Frage

I need to make some API calls from inside a Resque job (which is just a plain old Ruby class) and those API calls need to include URLs to resources on my site.

Is it "correct" to just add this to my class definition?

include Rails.application.routes.url_helpers

Or is there an "expected" way to do this?

War es hilfreich?

Andere Tipps

In your controller:

Rails 1.x: include Rails.application.routes.url_helpers

Rails 2.x: include ActionController::UrlWriter

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top