This file contains hidden or 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
In some cases you need to set the default_url of paper clip base on some condition. e.g. You want to set default image on basis of gender of user. For this purpose this gist can make it possible to use a method as default_url. Just copy paper_clip_default_url_fix.rb to initializers folder, and use default_url as mentioned in model.rb |
This file contains hidden or 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
module Resque | |
module AsyncHandling | |
# To disable (in config.after_initialize): | |
# Resque::AsyncHandling.enabled = false | |
mattr_accessor :enabled | |
self.enabled = true | |
def handle_asynchronously(original_method, params = { }) | |
if enabled | |
now_method = "#{ original_method }_now" |
This file contains hidden or 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
#!/usr/bin/env ruby19 | |
require 'optparse' | |
# Report erros that are caused by invoking a method when | |
# an instance is not in the proper state to do so. | |
class StateError < Exception | |
end | |
# Instances of class Tee can send output to several destinations |