{"action":"opened","issue":{"url":"https://api.github.com/repos/rails/rails/issues/22490","labels_url":"https://api.github.com/repos/rails/rails/issues/22490/labels{/name}","comments_url":"https://api.github.com/repos/rails/rails/issues/22490/comments","events_url":"https://api.github.com/repos/rails/rails/issues/22490/events","html_url":"https://github.com/rails/rails/issues/22490","id":120220312,"number":22490,"title":"Problem with String 'Null' and Postgres string arrays","user":{"login":"ascastro","id":67388,"avatar_url":"https://avatars.githubusercontent.com/u/67388?v=3","gravatar_id":"","url":"https://api.github.com/users/ascastro","html_url":"https://github.com/ascastro","followers_url":"https://api.github.com/users/ascastro/followers","following_url":"https://api.github.com/users/ascastro/following{/other_user}","gists_url":"https://api.github.com/users/ascastro/gists{/gist_id}","starred_url":"https://api.github.com/users/ascastro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ascastro/subscriptions","organizations_url":"https://api.github.com/users/ascastro/orgs","repos_url":"https://api.github.com/users/ascastro/repos","events_url":"https://api.github.com/users/ascastro/events{/privacy}","received_events_url":"https://api.github.com/users/ascastro/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-12-03T16:56:21Z","updated_at":"2015-12-03T16:56:21Z","closed_at":null,"body":"So that it is easier to replicate this issue (DB is Postgres), let's assume we have the following migration:\r\n```ruby\r\nclass CreatePeople < ActiveRecord::Migration\r\n  def change\r\n    create_table :people do |t|\r\n      t.string :names, array: true, default: []\r\n\r\n      t.timestamps null: false\r\n    end\r\n  end\r\nend\r\n```\r\nand the model\r\n```ruby\r\nclass Person < ActiveRecord::Base\r\nend\r\n```\r\n\r\nSaving the string 'Null' (which can be a surname) to the array `names`, will cause the object to have a `nil` entry in the array:\r\n```ruby\r\n$ bin/rails console\r\nLoading development environment (Rails 4.2.2)\r\n> person = Person.create(names: ['Joe', 'Null'])\r\n> person.reload.names\r\n=> [\"Joe\", nil]\r\n```"}}