flarg 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -0,0 +1,34 @@
1
+ # Flarg
2
+
3
+ Adds a class to your ralis app that stores configuration variables.
4
+
5
+ [![Build Status](https://secure.travis-ci.org/brundage/flarg.png)](http://travis-ci.org/brundage/flarg)
6
+ [![Dependency Status](https://gemnasium.com/brundage/flarg.png)](https://gemnasium.com/brundage/flarg)
7
+
8
+ ## WTF?
9
+
10
+ > Isn't there a `Rails.application.config`?
11
+
12
+ Yes, and this gem uses it so you can do:
13
+
14
+ # config/initializers/some_initializer.rb
15
+
16
+ MyKeenAppConfig.configure do |config|
17
+
18
+ config.use_recursive_sql = Rails.application.config.database_configuration[Rails.env]["adapter"] == "postgresql"
19
+
20
+ end
21
+
22
+ Then in your app somewhere:
23
+
24
+ class Thing < ActiveRecord::Base
25
+
26
+ def ancestors
27
+ if MyKeenAppConfig.config.use_recursive_sql
28
+ self.class.find_by_sql(%Q^ WITH RECURSIVE parents AS ( SELECT .... )^)
29
+ else
30
+ Rails.logger.debug("Recursive SQL not supported by this database")
31
+ end
32
+ end
33
+
34
+ Flarg namespaces keys in `Rails.application.config` so you don't have to!
@@ -1,5 +1,4 @@
1
1
  require 'active_support'
2
- require 'singleton'
3
2
  require 'flarg/version'
4
3
 
5
4
  module Flarg
@@ -1,4 +1,6 @@
1
1
  require 'rails/railtie'
2
+ require 'singleton'
3
+
2
4
  module Flarg
3
5
  class Railtie < Rails::Railtie
4
6
 
@@ -1,3 +1,3 @@
1
1
  module Flarg
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flarg
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: