Skip to content

Instantly share code, notes, and snippets.

@jdanielnd
Created May 13, 2015 14:22
Show Gist options
  • Save jdanielnd/07f81dd2198df828f9ba to your computer and use it in GitHub Desktop.
Save jdanielnd/07f81dd2198df828f9ba to your computer and use it in GitHub Desktop.
require 'active_support/configurable'
module Statistics
include ActiveSupport::Configurable
config_accessor :end_point
self.config.server ||= "https://statistics.appprova.com.br"
def self.some_method(args = {}, params = {})
uri = URI.parse("#{Statistics.config.server}/api/bla/bla")
...
end
end
## Se quiser mudar o server default
## Initializer
config/initializers/statistics.rb
require 'statistics'
Statistics.configure do |config|
config.server = "http://someother.appprova.com.br"
end
@joaofraga
Copy link

👍

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