scope-chain

Scope Chain in Javascript

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 debugging tool) have a build in function or method to print out the scope chains, so as to look at the different situations of what a scope chain contains?

Does any language or debug tool have a way to print out the scope chain for examination? Thanks. ...

Is Ruby's "binding" the same as Scope Chain?

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? ...

How to order by an attribute of a parent for a polymorphic model in ActiveRecord?

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...