Post IF - undefined local variable
hash[:tree] = tree if (tree = _get_path_tree_array(params, path, deep + 1)) && ! tree.empty?
=> undefined local variable or method `tree' for #Content:0x92d96b0
if (tree = _get_path_tree_array(params, path, deep + 1)) && ! tree.empty?
hash[:tree] = tree
=> WORK FINE!¶
Content - is a: class Content < ActiveRecord::Base in Ruby on Rails 3.2.11
Actions #1 [ruby-core:51604]
Updated by matz (Yukihiro Matsumoto) about 10 years ago
- Status changed from Open to Rejected
The local variables are considered defined after the assignments, so that in above case, tree appears before the assignment is intentionally left undefined.