Extract ORM specifics

rework of PR #454

a good case <https://github.com/advancedcontrol/doorkeeper-couchbase>
Ok, remove them later.
I forget `NoMethodError` is a subclass of `NameError`, it misleads me when I'm debugging models.