Add parent query methods

While adding ancestry to some STI classes I found myself wanting to add a validation to restrict non-leaf nodes:

```ruby
class Leaf < ActiveRecord::Base
  has_ancestry

  validate :parent_is_leaf_group, if: :parent?

  def parent_is_leaf_group
    errors.add :parent, "is not leaf group" unless parent.is_a? LeafGroup
  end
end

class LeafGroup < Leaf
  # Things Leaf can't have...
end
```

Sadly, my friend the [query attribute method](https://github.com/rails/rails/blob/3d55957c3d024e592f847b1128e939038f3588a7/activerecord/lib/active_record/attribute_methods/query.rb) (`parent?`) wasn't available—so I added it. It adds greater semantic value than `if: :parent_id` in situations like this, while being more efficient than `if: :parent`.

Tests were added also, but one test on master was already failing.