Permalink
Browse files

Use ActionMailer's default_url_options for the url options of UrlJob

  • Loading branch information...
1 parent c076e5b commit 917b0be62f110fdf152f3ea7b06df9ec8d819f5e @frison committed Apr 3, 2011
Showing with 6 additions and 2 deletions.
  1. +1 −1 README.rdoc
  2. +5 −1 lib/url_job/job.rb
View
@@ -32,7 +32,7 @@ By creating a UrlJob using the following:
uj = UrlJob::Job.from_object(Redirector.new("http://frison.ca"))
And visiting:
- http://localhost:3000/uj/#{uj.token} or http://localhost:3000/uj/#{uj.path} or #{uj.url} (assuming default_url_options[:host] is setup)
+ http://localhost:3000/uj/#{uj.token} or http://localhost:3000/uj/#{uj.path} or #{uj.url} (assuming default_url_options[:host] is setup for ActionMailer)
The result will be deserializing the Redirector job, and calling it's perform method.
The perform method must return an object that responds to either: 'redirect_to' or 'render', and the corresponding action will occur. The perform method will be passed in a dictionary with the following keys:
View
@@ -27,7 +27,11 @@ def path
end
def url
- url_job_url(:token => self.token)
+ url_job_url(:token => self.token, :host => host)
+ end
+
+ def host
+ ActionMailer::Base.default_url_options[:host]
end
def limit_reached?

0 comments on commit 917b0be

Please sign in to comment.