Skip to content

Deploying new content_type (b) with many_to_many relationship with existing content_type (a) doesn't add empty related property to content_entries already created. #213

@greyskin

Description

@greyskin

Steps to reproduce:

  1. Create content_type_a
  2. Deploy content_type_a via wagon
  3. In the Back Office, create an entry under content_type_a
  4. Create a new content_type_b with many_to_many relationship with content_type_a
  5. Update content_type_a definition to include this relationship
  6. Deploy content_types via wagon
  7. Add the following to a page:
    {% action 'get content_entry' %}
        var contentEntry = findEntry('content_type', 'content-entry-slug');
        setProp('contentEntry', contentEntry);
    {% endaction %}
    
  8. Deploy the page via wagon
  9. Visit the page in a browser
  10. Watch it break. The Back Office error messge will be to the tune of:

Action error - undefined method `content_type_b_ids' for #Locomotive::Steam::ContentEntry:xxx...

Workaround: Create an entry under content_type_b and relate it to the content_type_a entry. I expect this populates the content_type_a entry with the missing content_entry_b property. The relationship can then be removed and the content_entry saved and the above code will not produce the error. (Tested)

I had thought that pulling the content_entries via wagon and then re-deploying would fix the issue but it does not. Interestingly, the content_entries are pulled including the missing content_type_b property in their data, but when reployed, the behaviour of findEntry remains the same. Only the workaround described above seems to change the behaviour.

Should not the deployment of content_type_b update the existing content_type_a entries to include the new content_type_b property?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions