GitHub Sale: sign up for any paid plan this week and pay nothing until January 1, 2009!  [ hide ]

public
Fork of brennandunn/preference_fu
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/dynamix/preference_fu.git
- 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
...
44
45
46
47
48
49
50
51
52
53
...
8
9
10
 
11
12
13
14
15
16
17
18
19
20
21
22
23
 
24
25
 
26
27
28
29
...
45
46
47
 
 
 
 
48
49
50
0
@@ -8,21 +8,22 @@ module PreferenceFu
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
@@ -44,10 +45,6 @@ module PreferenceFu
0
       end
0
     end
0
     
0
- def preference_options
0
- @@preference_options
0
- end
0
-
0
     def instantiate_with_preferences(*args)
0
       record = instantiate_without_preferences(*args)
0
       record.prefs

Comments

    No one has commented yet.