Merge pull request #45 from mcamou/#40

Class table inheritance: closes #40
Fixed a bug in fetch_by_id when inheritance is :leaf