Netflix / fast_jsonapi

No Longer Maintained - A lightning fast JSON:API serializer for Ruby Objects.
Apache License 2.0
5.07k stars 425 forks source link

How can I reference dynamic attributes inside of other dynamic attributes? #447

Open benlieb opened 4 years ago

benlieb commented 4 years ago

The following fails with undefined method 'person_path'

  attribute :person_path do |obj|
    url_helpers.person_path obj 
  end

  attribute :edit_person_path do |obj|
    "#{obj.person_path}/edit/person"
  end
esambo commented 3 years ago

Extracting it to a class method might help: https://github.com/Netflix/fast_jsonapi/issues/344#issuecomment-438640296