I’ve created a module to include in a 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
@type = ‘circle’
@type = ‘square’
x = Shape.new
puts x.type # ‘square’
puts x.type # ‘circle’
My distilled Rails example would be something like this. I require
the file in application.rb.
@test_var = ‘y’
class UsersAdminController < ApplicationController
include EventControls layout '1col_admin' attr_accessor :test_var def some_action @test_var = 'x' change_test_var end
Using debug(@test_var) the value doesn’t ever appear to change from ‘x’