public
Description: Allows the storage of a number of boolean fields with just one table column
Homepage: http://www.brennandunn.com
Clone URL: git://github.com/brennandunn/preference_fu.git
Search Repo:
- fixed a class_variable bug, which prevented using preference_fu in more 
then one model at the same time
dynamix (author)
Tue Apr 08 15:57:20 -0700 2008
commit  c47a0693b9915db24ea1901260a99ab050dbd1a9
tree    d4f738a4223c91e68a4296252449e18271b08379
parent  7c1c0e3e07aa706f422a4ec3aeb3fe1104f4d080
...
8
9
10
11
 
12
13
14
15
16
17
 
18
19
20
21
22
23
 
24
25
 
26
27
28
...
42
43
44
45
46
47
48
49
50
51
...
8
9
10
 
11
12
13
14
15
16
17
18
19
20
21
22
23
 
24
25
 
26
27
28
29
...
43
44
45
 
 
 
 
46
47
48
0
@@ -8,21 +8,22 @@
0
   end
0
   
0
   module ClassMethods
0
-
0
+
0
     def has_preferences(*options)
0
       alias_method_chain :initialize, :preferences
0
       
0
       class_eval do
0
         class << self
0
           alias_method_chain :instantiate, :preferences
0
+ attr_accessor :preference_options
0
         end
0
       end
0
       
0
       config = { :column => 'preferences' }
0
       
0
- idx = 0; @@preference_options = {}
0
+ idx = 0; self.preference_options = {}
0
       options.each do |pref|
0
- @@preference_options[2**idx] = { :key => pref.to_sym, :default => false }
0
+ self.preference_options[2**idx] = { :key => pref.to_sym, :default => false }
0
         idx += 1
0
       end
0
       
0
@@ -42,10 +43,6 @@
0
       if idx
0
         preference_options[idx][:default] = default
0
       end
0
- end
0
-
0
- def preference_options
0
- @@preference_options
0
     end
0
     
0
     def instantiate_with_preferences(*args)

Comments

    No one has commented yet.