ahlatimer/rabl — pull request #4 by DouweM (2013-08-21 20:52:38+00:00)
Title: Don't choke on symbol attribute values.

When you have an attribute with a `Symbol` value (which is perfectly fine in a Mongoid setup, where it's a supported type out of the box), for example a `:status` attribute that can have value `:unavailable`, the following would happen:

`attribute(:status)` calls `data_object_attribute(:status)` which calls `@_object.send(:status)` which returns `:unavailable`, which is followed by a call to `is_collection?(:unavailable)` which calls `data_object(:unavailable)` which calls `@_object.send(:unavailable)` which raises a `NoMethodError`.

So what I've done is check if `@_object.respond_to?(data)` in `#data_object`, as well as add a second attribute `follow_symbols` to `#is_collection?` and `#is_object?`, which is set to false in the call from `data_object_attribute` because here we just care whether `@_object.__send__(:status)` refers to a collection directly.