locomotivecms / wagon

Wagon is a command line tool that let's you develop for Locomotive right on your local machine.
https://www.locomotivecms.com
MIT License
188 stars 117 forks source link

wagon serve + belongs_to "chain" results in "Action error - undefined method `is_relationship?' for nil:NilClass" #398

Open greyskin opened 3 years ago

greyskin commented 3 years ago

I have the following content_types setup:

(Note the "chained" belongs_to relationship. content_type1 belongs to content_type2 which belongs to content_type3.)

I have the following {% action %}

{% action "test" %}

    var entries = allEntries(
        'content_type2', {
            name: 'Test1'
        }
    );

    setProp('entries', entries);

{% endaction %}

{{ entries }}

When I deploy to station.locomotive.works this all works fine - it returns a print out of the Test1 content entry, like so:

{"_id"=>"xxx", "_slug"=>"test1", "_visible"=>true, "_position"=>0.0, "content_type_slug"=>"content_type2", "created_at"=>"xxx", "updated_at"=>"xxx", "_label"=>"Test1", "name"=>"Test1", "system_url"=>"", "content_type3_id"=>"xxx", "seo_title"=>"", "meta_description"=>"", "meta_keywords"=>""}

However, when I run wagon serve, I get the following error message:

Action error - undefined method `is_relationship?' for nil:NilClass

I can get print outs for content_type1 and content_type3 without any issue when running wagon serve. Only content_type2 (with the "chained" belongs_to relationship) causes an error.