I am trying to make local variables permanent for my model, but although it seems that it is not so easy Used to be.
I have this in my model:
class coupon & lt; ActiveRecord :: Base @ user name = "blank" @ admin = false def self.setUser (name, isAdmin) @ user name = name @ admin = isadmin enddef self.get_user (user) to use current_user Effort, but did not work. I call it to the controller (I think this is not the best practice) # @ User = The user self User (user.user, user.admin?) End DEF_synchronized errors.ad ("property_off", "name is not valid: # {@ user name}") if! Validator? End end DEF legal property_off? Return Property_ == @ User Name # @ Admin Expiration End Really get "a blank" or a new value instead of user name in set.user. How do I create these values? I have printed the values in each method, so that they remain inside the law but not for any reason.
@username is always zero or "" when it is near_not_card. Why is this and how do I create it? Thanks a lot.
When I set it either (get_user method) I can not access it. I agree that if you forget about a database table, then you do not have validity property_of
Make this one, that is why every variable is constant.
Comments
Post a Comment