Project

flarg

0.0
No commit activity in last 3 years
No release in over 3 years
A gem that adds quick configuration DSL to rails projects
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

 Project Readme

Flarg

Adds a class to your ralis app that stores configuration variables.

Build Status Dependency Status Code Climate Buggerall

WTF?

Isn't there a Rails.application.config?

Yes, and this gem uses it so you can do:

# config/initializers/some_initializer.rb

MyKeenAppConfig.configure do |config|

  config.use_recursive_sql = Rails.application.config.database_configuration[Rails.env]["adapter"] == "postgresql"

end

Then in your app somewhere:

class Thing < ActiveRecord::Base

  def ancestors
    if MyKeenAppConfig.config.use_recursive_sql
      self.class.find_by_sql(%Q^ WITH RECURSIVE parents AS ( SELECT .... )^)
    else
      Rails.logger.debug("Recursive SQL not supported by this database")
    end
  end

Flarg namespaces keys in Rails.application.config so you don't have to!