In rails, why can’t one method see an instance variable created in another?
I have this code
get ‘/qqq’, to: ‘application#first’
get ‘/rrr’, to: ‘application#second’
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
render plain: “.”
render plain: “X”+@v.to_s+“X”
I go to /qqq
then I go to /rrr
I expect XaaaX
But I get XX
For some reason, def second, cannot see the instance variable created in def first
If I make a plain ruby program without rails
then in that program, it works as expected, the bbb method sees the instance variable created in the aaa method.
Why though in rails, can one method not see the instance variable created in another method?