Rails Controller/Model methods
I am watching Code School Rails testing course. There is an instance of
the class zombie. The zombie model has a method:
def avatar_url
...
end
Within the test, .rb file has the following:
z.avatar_url
When I call a method like this, how does Rails distinguish if I'm calling
a controller or model method? I hadn't thought of calling a model method
from other than a controller, and only like Model.method and not
object.method.
If both my controller and my model have a method with the same name, how
would Rails know which one to call?
No comments:
Post a Comment