1
0
Fork 0
mirror of https://github.com/drapergem/draper synced 2023-03-27 23:21:17 -04:00
draper/lib
Bruno Castro 5e4f529bb8 fix: Make CollectionDecorator respond_to? to ORM methods (#850)
## Testing
1. Create a decorator for the model and its association
```ruby
class OrderHistoryDecorator < Draper::Decorator
  delegate_all
end

class OrderDecorator < Draper::Decorator
  delegate_all

  decorates_association :order_histories, with: OrderHistoryDecorator
end
```

2. Call `respond_to?` with some ORM method allowed by the strategy
```ruby
[1] pry(main)> order.order_histories.decorate.respond_to?(:includes)
=> true
```

## References
* method_missing [usage](https://thoughtbot.com/blog/always-define-respond-to-missing-when-overriding)
2019-03-16 14:15:16 -05:00
..
draper fix: Make CollectionDecorator respond_to? to ORM methods (#850) 2019-03-16 14:15:16 -05:00
generators Refactor generator for TestUnit, RSpec (#816) 2017-07-20 08:51:30 -05:00
draper.rb feat: Include ORM associations in CollectionDecorator (#845) 2019-02-25 10:44:19 -06:00