representable icon indicating copy to clipboard operation
representable copied to clipboard

:parse_strategy is deprecated

Open samnang opened this issue 10 years ago • 3 comments

When I used the option parse_strategy: :sync which is working fine with my solution, but it shows deprecated warning message:

[Representable] :parse_strategy is deprecated. Please use a populator.

I try to find doc and read some source codes to understand populaor option, but I still couldn't figure out. Could someone point to me the the equivalent new option populator that has the same functionality to parse_strategy: :sync?

samnang avatar Dec 03 '15 05:12 samnang

Doubling that, the docs link for populator is empty - http://trailblazer.to/gems/representable/3.0/populator.html

faucct avatar Jan 18 '16 07:01 faucct

I have come up with a migration from parse_strategy to populator lambda, the named method signature should look similar:

collection :cast_members,
           parse_strategy: lambda do |fragment, _, options|
             represented = self
             ...
           end

collection :cast_members,
           populator: lambda do |fragment, represented:, **options|
             ...
           end

faucct avatar Jan 18 '16 13:01 faucct

Is there any documentation for the populator option? This is still empty: http://trailblazer.to/gems/representable/3.0/populator.html

What's the equivalent for parse_strategy: :find_or_initialize?

petebrowne avatar Nov 02 '16 19:11 petebrowne