Displaying 1 result from an estimated 1 matches for "shapestuff".
Did you mean:
savestuff
2008 May 17
1
Scope Confusion - Controller iVars in Modules
...Controller. Basically it works,
but I am expecting methods in the module to have access to instance
variables from the controller, and that appears to not be the case.
Yet, a simple Ruby example says it should be. I''m not sure what''s
different.
Simple Example:
module ShapeStuff
def set_type
@type = ''circle''
end
end
class Shape
include ShapeStuff
attr_accessor :type
def initialize
@type = ''square''
end
end
x = Shape.new
puts x.type # ''square''
x.set_type...