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
187 stars 117 forks source link

Inconsistency between Wagon and Engine (content_type_slug_singular vs content_type_slug_singluar_id) #406

Open greyskin opened 2 years ago

greyskin commented 2 years ago

When creating a JS object (to use in a Liquid Actions API createEntry), the following doesn't work in wagon:

var order = {
    name: foo,
    user: bar.id // where the "user" field refers to "users" content_type; "orders" belongs_to "users"; "users" has_many "orders"
}

order = createEntry( 'orders', order );

Note: user: bar.id

The above will create an order with nil user:

{"name"=>"foo", "user_id"=>nil}

However, if I upload this to engine, the above will create an order with a user.

{"name"=>"foo", "user_id"=>"bar"}

To get it working in wagon, I have to re-write my JS object as follows:

var order = {
    name: foo,
    user_id: bar.id
}

Note: _userid: bar.id

However, conversely to the first code sample, if I upload the above to engine, it doesn't work.

Am I doing something wrong?