fast_jsonapi icon indicating copy to clipboard operation
fast_jsonapi copied to clipboard

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

Open benlieb opened this issue 4 years ago • 1 comments

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

benlieb avatar Nov 05 '19 14:11 benlieb

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

esambo avatar Feb 19 '21 22:02 esambo