Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

null attributes serialized to "null" string #364

Closed
codyfauser opened this Issue · 2 comments

4 participants

Cody Fauser John Lynch Harry Brundage James MacAulay
Cody Fauser

Example code:

class Shopify.EmailTemplate extends Shopify.Model
  @persist Shopify.APIStorage
  @encode 'body', 'body_html', 'include_html', 'name', 'title'

  preview: ->
    new Batman.Request
      url: "/admin/email_templates/preview_copy.json"
      method: "post"
      data: 
        email_template: @toJSON()

Object constructed server side:

#<EmailTemplate id: nil, name: "Order Confirmation", body_html: "null">

Harry Brundage airhorns was assigned
John Lynch

It seems that the null value is propagated correctly through Batman, and then gets encoded to "foo=bar&baz=null" by the jQuery.ajax code.

$.param({foo: null}) => "foo=null"
$.param({foo: ""}) => "foo="

See this jQuery bug

John Lynch

OK, I just saw this commit that should have fixed it as long as you source the solo or rails extras... 7913db6

Harry Brundage airhorns closed this in 201c47f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.