J
Joshua Muheim
Hi all
Just a small newbie question: When calling a method inside an object, I
should always use self.method_name for good style, right? I know that I
could always only use "method_name", but it's a bit prone to errors
because I could have also a local variable called "method_name", and
when I use "self." I always call the method, and not a potentially
available local variable.
So it's always better style to use:
def validate
self.errors.add_to_base("...")
end
instead of:
def validate
errors.add_to_base("...")
end
Right?
Thanks
Josh
Just a small newbie question: When calling a method inside an object, I
should always use self.method_name for good style, right? I know that I
could always only use "method_name", but it's a bit prone to errors
because I could have also a local variable called "method_name", and
when I use "self." I always call the method, and not a potentially
available local variable.
So it's always better style to use:
def validate
self.errors.add_to_base("...")
end
instead of:
def validate
errors.add_to_base("...")
end
Right?
Thanks
Josh