Model questions about using?


#1

I have an employee model. I want to be able to say:

employee.isAdmin? in my view

so in the model I have:

def isAdmin?
if self.role.name == “Administrator”
true
end
end

When run I get a blank screen, no errors or anything, whats wrong with
the isAdmin? method? If I take out the if self… line it is returning
true.


#2

James W. wrote:

I have an employee model. I want to be able to say:

employee.isAdmin? in my view

so in the model I have:

def isAdmin?
if self.role.name == “Administrator”
true
end
end

When run I get a blank screen, no errors or anything, whats wrong with
the isAdmin? method? If I take out the if self… line it is returning
true.

Sorry solved!

I changed it to

def isAdmin?
true if self.role.name == “Administrator”
end

and it would have helped if i spelled administrator correctly elsewhere!