Topic: ruby has class scope not method scope, correct?
ruby has class scope not method scope, correct?
So in this class, for example:
#@resource_model_name ||= self.class.resource_model_name || controller_name.singularize
@resource_model_name ||= controller_name.singularize
@resource_model ||= Kernel.const_get(@resource_model_name.camelize)
when resource_model_name is called, resource_model_name returns an instance variable @resource_model_name as part of the return value in extract_resource_model method. Now that instance variable @resource_model_name is available throughout all the instance methods in that class, correct? That's why I am able to access it without any problems with scope resolution in resource_model, correct?
Thanks for response.