{"action":"created","issue":{"url":"https://api.github.com/repos/Fullscreen/bh/issues/131","labels_url":"https://api.github.com/repos/Fullscreen/bh/issues/131/labels{/name}","comments_url":"https://api.github.com/repos/Fullscreen/bh/issues/131/comments","events_url":"https://api.github.com/repos/Fullscreen/bh/issues/131/events","html_url":"https://github.com/Fullscreen/bh/issues/131","id":77712509,"number":131,"title":"Validations when using fields_for not displaying correctly","user":{"login":"KMontag42","id":1686738,"avatar_url":"https://avatars.githubusercontent.com/u/1686738?v=3","gravatar_id":"","url":"https://api.github.com/users/KMontag42","html_url":"https://github.com/KMontag42","followers_url":"https://api.github.com/users/KMontag42/followers","following_url":"https://api.github.com/users/KMontag42/following{/other_user}","gists_url":"https://api.github.com/users/KMontag42/gists{/gist_id}","starred_url":"https://api.github.com/users/KMontag42/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KMontag42/subscriptions","organizations_url":"https://api.github.com/users/KMontag42/orgs","repos_url":"https://api.github.com/users/KMontag42/repos","events_url":"https://api.github.com/users/KMontag42/events{/privacy}","received_events_url":"https://api.github.com/users/KMontag42/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-05-18T16:10:30Z","updated_at":"2015-05-22T13:23:41Z","closed_at":null,"body":"Hey!\r\n\r\nAnother `fields_for` related issue that I've come across.\r\n\r\nHere is a screenshot of the form that I am working on (standard devise goodness)\r\n![image](https://cloud.githubusercontent.com/assets/1686738/7684629/8578ae38-fd55-11e4-8d1d-f96fb6f9afa3.png)\r\n\r\nAs you can see the validations are working great for the first-level form fields.\r\n\r\nHere is the form's view itself:\r\n```erb\r\n<%= form_for(resource, as: resource_name, url: registration_path(resource_name), layout: :basic) do |f| %>\r\n\r\n  <%= f.text_field :first_name, autofocus: true %>\r\n\r\n  <%= f.text_field :last_name %>\r\n\r\n  <%= f.fields_for :foo, fieldset: false do |foo| %>\r\n    <%= foo.text_field :name, label: 'Company' %>\r\n  <% end %>\r\n\r\n  <%= f.email_field :email %>\r\n\r\n  <%= f.password_field :password, help: 'Minimum 8 characters' %>\r\n\r\n  <%= f.password_field :password_confirmation, autocomplete: \"off\" %>\r\n\r\n  <%= f.submit \"Sign up\", class: 'btn-lg btn-block' %>\r\n\r\n<% end %>\r\n```\r\n\r\nHowever for the `foo` model, I have this validator:\r\n```ruby\r\nvalidates_uniqueness_of :name, case_sensitive: false\r\n```\r\n\r\nWhen I run a debugger and check the errors on the `resource` I can see the proper error listed:\r\n(added \\n for readability)\r\n```ruby\r\n#<ActiveModel::Errors:0x000001143b0528 \r\n@base=#<User id: nil, email: \"kmontag@foobar.com\", \r\nencrypted_password: \"$2a$10$AiSLZb7QcPt9cNbCeubVmeyO/32le4NbTEoF0vEGsL/...\",\r\nreset_password_token: nil, \r\nreset_password_sent_at: nil, \r\nremember_created_at: nil, \r\nsign_in_count: 0, \r\ncurrent_sign_in_at: nil, \r\nlast_sign_in_at: nil, \r\ncurrent_sign_in_ip: nil,\r\nlast_sign_in_ip: nil, \r\ncreated_at: nil, \r\nupdated_at: nil, \r\nfirst_name: \"\", \r\nlast_name: \"Montag\", \r\npublisher_id: nil, \r\ninvitation_token: nil, \r\ninvitation_created_at: nil, \r\ninvitation_sent_at: nil, \r\ninvitation_accepted_at: nil,\r\ninvitation_limit: nil,\r\ninvited_by_id: nil,\r\ninvited_by_type: nil, \r\ninvitations_count: 0>, \r\n@messages={\r\n:\"foo.name\"=>[\"has already been taken\"], \r\n:first_name=>[\"can't be blank\"], \r\n:email=>[\"has already been taken\"]}\r\n>\r\n```\r\n\r\nThe `:foo.name` error is in `resource.errors` correctly, however it isn't showing up on the form at all.\r\n\r\nThe model relations in question are:\r\n```\r\nUser\r\nbelongs_to :foo\r\n```\r\n```\r\nfoo\r\nhas_many :users\r\n```\r\n\r\nAnd the `resource` in the form is a `User`\r\n\r\nAny ideas? Am I missing something?\r\n\r\n<3"},"comment":{"url":"https://api.github.com/repos/Fullscreen/bh/issues/comments/104659628","html_url":"https://github.com/Fullscreen/bh/issues/131#issuecomment-104659628","issue_url":"https://api.github.com/repos/Fullscreen/bh/issues/131","id":104659628,"user":{"login":"KMontag42","id":1686738,"avatar_url":"https://avatars.githubusercontent.com/u/1686738?v=3","gravatar_id":"","url":"https://api.github.com/users/KMontag42","html_url":"https://github.com/KMontag42","followers_url":"https://api.github.com/users/KMontag42/followers","following_url":"https://api.github.com/users/KMontag42/following{/other_user}","gists_url":"https://api.github.com/users/KMontag42/gists{/gist_id}","starred_url":"https://api.github.com/users/KMontag42/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KMontag42/subscriptions","organizations_url":"https://api.github.com/users/KMontag42/orgs","repos_url":"https://api.github.com/users/KMontag42/repos","events_url":"https://api.github.com/users/KMontag42/events{/privacy}","received_events_url":"https://api.github.com/users/KMontag42/received_events","type":"User","site_admin":false},"created_at":"2015-05-22T13:23:41Z","updated_at":"2015-05-22T13:23:41Z","body":"![](https://i.imgur.com/872FDBm.gif)\r\n\r\nThis is exactly what I needed! Thank you so much for the information and very detailed response!!"}}