Hi,
I've reading scope chain in Javascript but it didn't make any sense to me, could any one tell me what is scope chain and how it works with a graphic or something even an idiot can understand. I googled it but I didn't find something comprehensible :(
Thanks in advance.
...
Does any language or debug tool have a way to print out the scope chain for examination? Thanks.
...
Ruby's eval() can be like
def showblock(&block)
puts eval("i * 3", block)
end
where block is the block passed into the function.
Instead of a block, a binding object can be passed in as well. Is the binding object the same as what is called the "scope chain" that is mentioned a lot when Javascript closure is discussed?
...
I think I worded that correctly...
I have a model called asset which is polymorphic:
class Asset < ActiveRecord::Base
belongs_to :assetable, :polymorphic => true
...
end
I have a class level method that acts as a scope:
def self.some_scope
assets = Asset.joins(:assetable).where('assetable.approved_at IS NOT NULL').order('asse...