J
Joe Ruby MUDCRAP-CE
In Rails (it's more of a Ruby question though
), I have:
def before_update
@var = get_old_var_value
end
and if get_old_var_value returns a false value it causes the update to
cancel. Is there some function that'll return true after setting the
var? Something like, oh I dunno, set_var
var, get_old_var_value).
Rails' write_attribute also seems to return the value of the var (so
false causes problems with it too). I know I can just simply do this:
def before_update
@var = get_old_var_value
true
end
But I'm just curious if there are other approaches.
Thanks,
Joe
def before_update
@var = get_old_var_value
end
and if get_old_var_value returns a false value it causes the update to
cancel. Is there some function that'll return true after setting the
var? Something like, oh I dunno, set_var
Rails' write_attribute also seems to return the value of the var (so
false causes problems with it too). I know I can just simply do this:
def before_update
@var = get_old_var_value
true
end
But I'm just curious if there are other approaches.
Thanks,
Joe