Skip to content

Instantly share code, notes, and snippets.

@wangjohn
Last active December 14, 2015 22:28
Show Gist options
  • Save wangjohn/5158062 to your computer and use it in GitHub Desktop.
Save wangjohn/5158062 to your computer and use it in GitHub Desktop.
## Define an application
class Application < Rails::Application
end
Application.new do
config.assets = "something"
# This doesn't work
initializers do
puts "Doing something here"
end
# This works correctly.
Rails::Application::initializers do
puts "Doing something there"
end
end
## Now initialize the application
module Rails
class Application
def initialize(&block)
# ... some stuff here ...
class_eval(&block)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment