Skip to content

Instantly share code, notes, and snippets.

@ryana
Created June 19, 2011 23:53
Show Gist options
  • Save ryana/1034924 to your computer and use it in GitHub Desktop.
Save ryana/1034924 to your computer and use it in GitHub Desktop.
doing hayzoos' job :P
class Vid < AR::Base
after_save :encode
private
def encode
VidEncoder.go(self)
end
end
class VidEncoder
include Rails.application.routes.url_helpers
# default_url_options should be set by server setup or
# a setup block in your test system
class < self
def go(obj)
Zencoder.stuff(:source_url => url_for(obj))
end
end
end
@AdventureDuck
Copy link

Last last comment: I didn't see your comment block in the code, before. I haven't found - anywhere online - a way to set default_url_options for the entire application. There must be a way. But nobody illustrates it. Not even the rails site, that I've found.

@AdventureDuck
Copy link

I know how to set it for an individual class - I've done that, successfully. But I should be able to set that somewhere for the entire application - so I don't have to have multiple lines like

config.action_mailer.default_url_options = ...
ZencoderCommunicator.default_url_options = ...

That's bullshit, when they're all the same setting. I need something like

config.default_url_options = ...

The others can override that value, if need be.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment