7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/softwear/auth/belongs_to_user.rb', line 7
def belongs_to_user_called(name, options = {})
foreign_key = "#{name}_id"
association_methods = Module.new
association_methods.module_eval " def \#{name}\n @\#{name} ||= User.find(\#{name}_id)\n end\n\n def \#{name}=(new)\n self.\#{foreign_key} = new.id\n @\#{name} = new\n end\n RUBY\n\n self.user_associations ||= []\n user_associations << name.to_sym\n\n send(:include, association_methods)\nend\n", __FILE__, __LINE__ + 1
|