{"action":"created","issue":{"url":"https://api.github.com/repos/solidusio/solidus/issues/1440","repository_url":"https://api.github.com/repos/solidusio/solidus","labels_url":"https://api.github.com/repos/solidusio/solidus/issues/1440/labels{/name}","comments_url":"https://api.github.com/repos/solidusio/solidus/issues/1440/comments","events_url":"https://api.github.com/repos/solidusio/solidus/issues/1440/events","html_url":"https://github.com/solidusio/solidus/pull/1440","id":176949405,"number":1440,"title":"Improve JS handling for OrdersController","user":{"login":"mtomov","id":1651750,"avatar_url":"https://avatars.githubusercontent.com/u/1651750?v=3","gravatar_id":"","url":"https://api.github.com/users/mtomov","html_url":"https://github.com/mtomov","followers_url":"https://api.github.com/users/mtomov/followers","following_url":"https://api.github.com/users/mtomov/following{/other_user}","gists_url":"https://api.github.com/users/mtomov/gists{/gist_id}","starred_url":"https://api.github.com/users/mtomov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mtomov/subscriptions","organizations_url":"https://api.github.com/users/mtomov/orgs","repos_url":"https://api.github.com/users/mtomov/repos","events_url":"https://api.github.com/users/mtomov/events{/privacy}","received_events_url":"https://api.github.com/users/mtomov/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/solidusio/solidus/labels/Code%20review%20needed","name":"Code review needed","color":"0e8a16"}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-09-14T16:05:34Z","updated_at":"2016-09-29T23:22:48Z","closed_at":"2016-09-29T23:22:40Z","pull_request":{"url":"https://api.github.com/repos/solidusio/solidus/pulls/1440","html_url":"https://github.com/solidusio/solidus/pull/1440","diff_url":"https://github.com/solidusio/solidus/pull/1440.diff","patch_url":"https://github.com/solidusio/solidus/pull/1440.patch"},"body":"  * Using an instance variable allows JS populate operations to have\r\n    access to the @order from within the rendered `.js.erb` files\r\n\r\n  * Assign all line_item errors to the order's base\r\n\r\n  * Allow to respond to JS requests for `#populate` and `#update` actions.\r\n    It is left for the developer to actually implement the `js.erb` views\r\n\r\n* Adjusts `#update` to perform the behave properly for JS actions as well\r\n\r\n--\r\n\r\nTo consider:\r\n\r\n  - to avoid the whole rescue operation, and manually assigning line item\r\n    errors to the order's `:base`, we'd need to do to be doing `order.save`\r\n    instead of `line_item.save!` in [`OrderContents`](https://github.com/solidusio/solidus/blob/master/core/app/models/spree/order_contents.rb#L151)\r\n\r\n  -> That would have the effect to \"automatically\" assign the line item\r\n     errors on the order in the form: `line_items.quantity` in Rails 4.x\r\n     and \"line_items[0].quantity\" in Rails 5\r\n\r\n\r\n  More info:\r\n  - https://github.com/rails/rails/pull/8638\r\n  - https://github.com/rails/rails/pull/19686"},"comment":{"url":"https://api.github.com/repos/solidusio/solidus/issues/comments/250619870","html_url":"https://github.com/solidusio/solidus/pull/1440#issuecomment-250619870","issue_url":"https://api.github.com/repos/solidusio/solidus/issues/1440","id":250619870,"user":{"login":"jhawthorn","id":131752,"avatar_url":"https://avatars.githubusercontent.com/u/131752?v=3","gravatar_id":"","url":"https://api.github.com/users/jhawthorn","html_url":"https://github.com/jhawthorn","followers_url":"https://api.github.com/users/jhawthorn/followers","following_url":"https://api.github.com/users/jhawthorn/following{/other_user}","gists_url":"https://api.github.com/users/jhawthorn/gists{/gist_id}","starred_url":"https://api.github.com/users/jhawthorn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jhawthorn/subscriptions","organizations_url":"https://api.github.com/users/jhawthorn/orgs","repos_url":"https://api.github.com/users/jhawthorn/repos","events_url":"https://api.github.com/users/jhawthorn/events{/privacy}","received_events_url":"https://api.github.com/users/jhawthorn/received_events","type":"User","site_admin":false},"created_at":"2016-09-29T23:22:48Z","updated_at":"2016-09-29T23:22:48Z","body":"Thanks again @mtomov"}}
{"actor":{"display_login":"jhawthorn"}}