I
I
IvanN7772017-01-27 12:19:42
ruby
IvanN777, 2017-01-27 12:19:42

Is it possible in rails to change the value of a class variable in a plugin?

I'm trying to refactor the code, but the question arose of how to change class variables in modules defined in mixins.
I tried to wrap everything in the method in Proc, return Proc and call it through self.instance_exec user, folder, &block before converting it to a block. However, the @@user class variable has not changed.
When debugging a method called by proc, the value is set, but disappears upon exit.
I set the @@user variable to nil before the method, in theory, does the block change already defined variables?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question