Module: CalnetAuthenticated::UserModel::PrepMethod

Defined in:
lib/calnet_authenticated/user_model.rb

Instance Method Summary collapse

Instance Method Details

#calnet_authenticated(options = {}) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/calnet_authenticated/user_model.rb', line 21

def calnet_authenticated(options={})
	validates_presence_of   :uid
	validates_uniqueness_of :uid

	include CalnetAuthenticated::UserModel::InstanceMethods
	extend  CalnetAuthenticated::UserModel::ClassMethods

	#	All I want is a reference to the
	#	calling model.

	#	This seems to work and I am surprised.
	#	>> User.object_id
	#	=> 2162702020
	#	>> CalnetAuthenticated::User.object_id
	#	=> 2162702020
	#	The purpose is to allow the user to specify
	#	the model name.  
#			class CalnetAuthenticated::User < self; end
#	=> class definition in method body
#			CalnetAuthenticated::User = Class.new( self )
#	=> dynamic constant assignment
#			eval "CalnetAuthenticated::User = self"
#			CalnetAuthenticated::User.model = self

#			CalnetAuthenticatedUser = self
#		didn't work due to something regarding the Role assocation
#		I should try with has_many :through rather than habtm

	$CalnetAuthenticatedUser = self

#			Object.class_eval do
##				class << self
#				attr_accessor :calnet_authenticated_user
#				calnet_authenticated_user=self
##				end
#			end
#			$calnet_authenticated_user=self
#			Object.class_eval do
#			define_method 'CalnetAuthenticated::User' do
#				self
#			end
#			end
#	=> just doesn't work
end