{"action":"created","issue":{"url":"https://api.github.com/repos/rails/rails/issues/21859","labels_url":"https://api.github.com/repos/rails/rails/issues/21859/labels{/name}","comments_url":"https://api.github.com/repos/rails/rails/issues/21859/comments","events_url":"https://api.github.com/repos/rails/rails/issues/21859/events","html_url":"https://github.com/rails/rails/pull/21859","id":109643347,"number":21859,"title":"Fix ActiveModel::SecurePassword int argument bug","user":{"login":"meinac","id":1840945,"avatar_url":"https://avatars.githubusercontent.com/u/1840945?v=3","gravatar_id":"","url":"https://api.github.com/users/meinac","html_url":"https://github.com/meinac","followers_url":"https://api.github.com/users/meinac/followers","following_url":"https://api.github.com/users/meinac/following{/other_user}","gists_url":"https://api.github.com/users/meinac/gists{/gist_id}","starred_url":"https://api.github.com/users/meinac/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/meinac/subscriptions","organizations_url":"https://api.github.com/users/meinac/orgs","repos_url":"https://api.github.com/users/meinac/repos","events_url":"https://api.github.com/users/meinac/events{/privacy}","received_events_url":"https://api.github.com/users/meinac/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":{"login":"chancancode","id":55829,"avatar_url":"https://avatars.githubusercontent.com/u/55829?v=3","gravatar_id":"","url":"https://api.github.com/users/chancancode","html_url":"https://github.com/chancancode","followers_url":"https://api.github.com/users/chancancode/followers","following_url":"https://api.github.com/users/chancancode/following{/other_user}","gists_url":"https://api.github.com/users/chancancode/gists{/gist_id}","starred_url":"https://api.github.com/users/chancancode/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chancancode/subscriptions","organizations_url":"https://api.github.com/users/chancancode/orgs","repos_url":"https://api.github.com/users/chancancode/repos","events_url":"https://api.github.com/users/chancancode/events{/privacy}","received_events_url":"https://api.github.com/users/chancancode/received_events","type":"User","site_admin":false},"milestone":null,"comments":10,"created_at":"2015-10-03T20:19:20Z","updated_at":"2015-10-06T22:18:01Z","closed_at":"2015-10-06T21:01:42Z","pull_request":{"url":"https://api.github.com/repos/rails/rails/pulls/21859","html_url":"https://github.com/rails/rails/pull/21859","diff_url":"https://github.com/rails/rails/pull/21859.diff","patch_url":"https://github.com/rails/rails/pull/21859.patch"},"body":"With this fix you can set integer values to password"},"comment":{"url":"https://api.github.com/repos/rails/rails/issues/comments/146018412","html_url":"https://github.com/rails/rails/pull/21859#issuecomment-146018412","issue_url":"https://api.github.com/repos/rails/rails/issues/21859","id":146018412,"user":{"login":"meinac","id":1840945,"avatar_url":"https://avatars.githubusercontent.com/u/1840945?v=3","gravatar_id":"","url":"https://api.github.com/users/meinac","html_url":"https://github.com/meinac","followers_url":"https://api.github.com/users/meinac/followers","following_url":"https://api.github.com/users/meinac/following{/other_user}","gists_url":"https://api.github.com/users/meinac/gists{/gist_id}","starred_url":"https://api.github.com/users/meinac/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/meinac/subscriptions","organizations_url":"https://api.github.com/users/meinac/orgs","repos_url":"https://api.github.com/users/meinac/repos","events_url":"https://api.github.com/users/meinac/events{/privacy}","received_events_url":"https://api.github.com/users/meinac/received_events","type":"User","site_admin":false},"created_at":"2015-10-06T22:18:01Z","updated_at":"2015-10-06T22:18:01Z","body":"> In my opinion this is validation concern\r\n\r\nYes you are right, this is a validation concern but in this case we are facing with another bug or performance issue about secure password module.\r\nSecurePassword works before ActiveModel validations. So If you have a validation like length validation to check whether password is in 4...20 range or not, SecurePassword works before this validation. I think this is wrong because it tries to build a hash for password attribute even if it's not valid. For example in case of invalid password you can respond with a JSON in 20ms but with SecurePassword it will take around 90ms because it tries to build hash of invalid password. If we can build a DSL for password validation to work before secure password or SecurePassword module respects to the ActiveModel validations then we can check whether password is string or not or any kind of validation without performance problems. You may say 90ms minus 20ms is equal to 70ms and you can not conquer the world around 70ms but if you have an API which works for an application targets around 1 billion people than you have to take care of 1ms. I would like to fix this performance issue and I think it will solve the problem mentioned in this pr too."}}