{"action":"closed","issue":{"url":"https://api.github.com/repos/DavyJonesLocker/client_side_validations-mongoid/issues/12","repository_url":"https://api.github.com/repos/DavyJonesLocker/client_side_validations-mongoid","labels_url":"https://api.github.com/repos/DavyJonesLocker/client_side_validations-mongoid/issues/12/labels{/name}","comments_url":"https://api.github.com/repos/DavyJonesLocker/client_side_validations-mongoid/issues/12/comments","events_url":"https://api.github.com/repos/DavyJonesLocker/client_side_validations-mongoid/issues/12/events","html_url":"https://github.com/DavyJonesLocker/client_side_validations-mongoid/issues/12","id":162429812,"number":12,"title":"Uniqueness validator doesn't work on update","user":{"login":"rubydev","id":599358,"avatar_url":"https://avatars.githubusercontent.com/u/599358?v=3","gravatar_id":"","url":"https://api.github.com/users/rubydev","html_url":"https://github.com/rubydev","followers_url":"https://api.github.com/users/rubydev/followers","following_url":"https://api.github.com/users/rubydev/following{/other_user}","gists_url":"https://api.github.com/users/rubydev/gists{/gist_id}","starred_url":"https://api.github.com/users/rubydev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rubydev/subscriptions","organizations_url":"https://api.github.com/users/rubydev/orgs","repos_url":"https://api.github.com/users/rubydev/repos","events_url":"https://api.github.com/users/rubydev/events{/privacy}","received_events_url":"https://api.github.com/users/rubydev/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-06-27T11:24:24Z","updated_at":"2016-06-27T12:45:29Z","closed_at":"2016-06-27T12:45:29Z","body":"client_side_validations: 4.2.4\r\nclient_side_validations-mongoid: 5.1.0\r\nclient_side_validations-simple_form: 3.2.3\r\nrails 4.2.6\r\nmongoid: 5.1.3\r\nmongo: 2.2.5\r\n\r\nmodel: \r\n<pre>\r\nclass TicketInstruction\r\n  include Mongoid::Document\r\n\r\n  field :name, type: String\r\n  validates :name, presence: true, uniqueness: { case_sensitive: false }\r\nend\r\n</pre>\r\n\r\nSee this request:\r\n<img width=\"748\" alt=\"request\" src=\"https://cloud.githubusercontent.com/assets/599358/16377910/1e7f9cd8-3c69-11e6-86be-6de636d86b9b.png\">\r\nis id[$oid] parameter correct? Or it should be without $oid?\r\n\r\nJavascript code:\r\n<pre>\r\nif(window.ClientSideValidations===undefined)window.ClientSideValidations={};window.ClientSideValidations.disabled_validators=[];window.ClientSideValidations.number_format={\"separator\":\".\",\"delimiter\":\",\"};if(window.ClientSideValidations.patterns===undefined)window.ClientSideValidations.patterns = {};window.ClientSideValidations.patterns.numericality=/^(-|\\+)?(?:\\d+|\\d{1,3}(?:\\,\\d{3})+)(?:\\.\\d*)?$/;if(window.ClientSideValidations.forms===undefined)window.ClientSideValidations.forms={};window.ClientSideValidations.forms['edit_ticket_instruction_52ab5d56f7bd9125c100000b'] = {\"type\":\"SimpleForm::FormBuilder\",\"error_class\":\"help-block\",\"error_tag\":\"span\",\"wrapper_error_class\":\"has-error\",\"wrapper_tag\":\"div\",\"wrapper_class\":\"form-group\",\"wrapper\":\"horizontal_form\",\"validators\":{\"ticket_instruction[name]\":{\"presence\":[{\"message\":\"can't be blank\"}],\"uniqueness\":[{\"message\":\"is already taken\",\"case_sensitive\":false,\"id\":{\"$oid\":\"52ab5d56f7bd9125c100000b\"}}]},\"ticket_instruction[description]\":{\"presence\":[{\"message\":\"can't be blank\"}]}}};\r\n</pre>\r\n\r\nI can't update object, because object with same name already exists, but it's the same object. By me in param should be only \"id\", not \"id[$oid]\"?\r\n\r\n<pre>\r\nTicketInstruction.count\r\n=> 52\r\n\r\nTicketInstruction.first\r\n=> #&ltTicketInstruction _id: 528e32b5f7bd91afd7000031, name: \"Student Agency\" .... &gt\r\n\r\nTicketInstruction.where(_id: { '$ne' => {\"$oid\":\"528e32b5f7bd91afd7000031\"} }).count\r\n=> 52\r\n\r\nTicketInstruction.where(_id: { '$ne' => \"528e32b5f7bd91afd7000031\" }).count\r\n=> 51\r\n</pre>\r\n\r\nEdit: id[$oid] was in parameter always, so problem is somewhere else.. "}}
{"actor":{"display_login":"rubydev"}}