{"action":"closed","issue":{"url":"https://api.github.com/repos/globalize/globalize-accessors/issues/16","labels_url":"https://api.github.com/repos/globalize/globalize-accessors/issues/16/labels{/name}","comments_url":"https://api.github.com/repos/globalize/globalize-accessors/issues/16/comments","events_url":"https://api.github.com/repos/globalize/globalize-accessors/issues/16/events","html_url":"https://github.com/globalize/globalize-accessors/issues/16","id":54014450,"number":16,"title":"Prevent empty localizations","user":{"login":"firedev","id":115612,"avatar_url":"https://avatars.githubusercontent.com/u/115612?v=3","gravatar_id":"","url":"https://api.github.com/users/firedev","html_url":"https://github.com/firedev","followers_url":"https://api.github.com/users/firedev/followers","following_url":"https://api.github.com/users/firedev/following{/other_user}","gists_url":"https://api.github.com/users/firedev/gists{/gist_id}","starred_url":"https://api.github.com/users/firedev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/firedev/subscriptions","organizations_url":"https://api.github.com/users/firedev/orgs","repos_url":"https://api.github.com/users/firedev/repos","events_url":"https://api.github.com/users/firedev/events{/privacy}","received_events_url":"https://api.github.com/users/firedev/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":11,"created_at":"2015-01-12T02:03:39Z","updated_at":"2015-05-14T05:46:51Z","closed_at":"2015-05-14T05:46:51Z","body":"I have posted it to Globalize initially https://github.com/globalize/globalize/issues/397 but I think it belongs here.\r\n\r\nI have a form that might have empty locales and they are being stored in database which is really annoying. Is there a way to prevent that?\r\n\r\nI had a cleaner once that was removing blank keys from params hash, but can't find where I had it and thought somebody might have solved this once and for all.\r\n\r\nThinking louder, I would say if there is a translation present for the given language and and empty one is submitted - the exisiting one should be deleted from the database.\r\n\r\n```\r\n=> Tour.last.translations\r\n  Tour Load (0.3ms)  SELECT  `tours`.* FROM `tours`  ORDER BY `tours`.`position` DESC LIMIT 1\r\n  Tour::Translation Load (0.4ms)  SELECT `tour_translations`.* FROM `tour_translations` WHERE `tour_translations`.`tour_id` = 12\r\n=> [\r\n  [0] #<Tour::Translation:0x00000109f4d170> {\r\n             :id => 12,\r\n        :tour_id => 12,\r\n         :locale => :en,\r\n     :created_at => Sat, 03 Jan 2015 13:09:12 ICT +07:00,\r\n     :updated_at => Sat, 03 Jan 2015 16:54:22 ICT +07:00,\r\n          :title => \"Whatever\",\r\n    :description => \"Ut voluptatem sit delectus nisi alias dignissimos rerum.\"\r\n  },\r\n  [1] #<Tour::Translation:0x00000109f4d008> {\r\n             :id => 28,\r\n        :tour_id => 12,\r\n         :locale => :es,\r\n     :created_at => Sat, 03 Jan 2015 16:54:22 ICT +07:00,\r\n     :updated_at => Sat, 03 Jan 2015 16:54:22 ICT +07:00,\r\n          :title => \"\",\r\n    :description => \"\"\r\n  },\r\n  [2] #<Tour::Translation:0x00000109f4ce50> {\r\n             :id => 29,\r\n        :tour_id => 12,\r\n         :locale => :zh,\r\n     :created_at => Sat, 03 Jan 2015 16:54:22 ICT +07:00,\r\n     :updated_at => Sat, 03 Jan 2015 16:54:22 ICT +07:00,\r\n          :title => \"\",\r\n    :description => \"\"\r\n  }\r\n]\r\n```"}}