Displaying 1 result from an estimated 1 matches for "unassignedus".
Did you mean:
unassigned
2009 Mar 14
9
null object pattern
I am trying to create a null object in my application. I would like to
assigned a null user object for anonymous/ mot-logged-in user, i.e. if
session variable has nil data.
In my User model, I have created a subclass like this:
class UnassignedUser < User
def save
false
end
def update
false
end
def username
"Unassigned"
end
def county_id
"-999"
end
def role_id
"5"
end
end
When I go to console to try out this model following is the output:
>> UnassignedUser....