{"action":"created","issue":{"url":"https://api.github.com/repos/activescaffold/active_scaffold/issues/436","labels_url":"https://api.github.com/repos/activescaffold/active_scaffold/issues/436/labels{/name}","comments_url":"https://api.github.com/repos/activescaffold/active_scaffold/issues/436/comments","events_url":"https://api.github.com/repos/activescaffold/active_scaffold/issues/436/events","html_url":"https://github.com/activescaffold/active_scaffold/issues/436","id":96504795,"number":436,"title":"Is there a way to trim the leading and trailing spaces for all the input before storing in the database","user":{"login":"kranthi3896","id":11405911,"avatar_url":"https://avatars.githubusercontent.com/u/11405911?v=3","gravatar_id":"","url":"https://api.github.com/users/kranthi3896","html_url":"https://github.com/kranthi3896","followers_url":"https://api.github.com/users/kranthi3896/followers","following_url":"https://api.github.com/users/kranthi3896/following{/other_user}","gists_url":"https://api.github.com/users/kranthi3896/gists{/gist_id}","starred_url":"https://api.github.com/users/kranthi3896/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kranthi3896/subscriptions","organizations_url":"https://api.github.com/users/kranthi3896/orgs","repos_url":"https://api.github.com/users/kranthi3896/repos","events_url":"https://api.github.com/users/kranthi3896/events{/privacy}","received_events_url":"https://api.github.com/users/kranthi3896/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-07-22T08:12:11Z","updated_at":"2015-07-22T09:14:06Z","closed_at":"2015-07-22T09:14:06Z","body":"I want to have all the string data types of my app should not have leading and trailing spaces . I need to have validations which throws error, i dont want to do that too... \r\n\r\nI want leading and the trailing spaces for all string data types to be trimmed , before I save it in to database.\r\n\r\nso, is there any easy method to do this for total app?"},"comment":{"url":"https://api.github.com/repos/activescaffold/active_scaffold/issues/comments/123631908","html_url":"https://github.com/activescaffold/active_scaffold/issues/436#issuecomment-123631908","issue_url":"https://api.github.com/repos/activescaffold/active_scaffold/issues/436","id":123631908,"user":{"login":"scambra","id":20515,"avatar_url":"https://avatars.githubusercontent.com/u/20515?v=3","gravatar_id":"","url":"https://api.github.com/users/scambra","html_url":"https://github.com/scambra","followers_url":"https://api.github.com/users/scambra/followers","following_url":"https://api.github.com/users/scambra/following{/other_user}","gists_url":"https://api.github.com/users/scambra/gists{/gist_id}","starred_url":"https://api.github.com/users/scambra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scambra/subscriptions","organizations_url":"https://api.github.com/users/scambra/orgs","repos_url":"https://api.github.com/users/scambra/repos","events_url":"https://api.github.com/users/scambra/events{/privacy}","received_events_url":"https://api.github.com/users/scambra/received_events","type":"User","site_admin":false},"created_at":"2015-07-22T09:14:06Z","updated_at":"2015-07-22T09:14:06Z","body":"You can add before_validation or before_save callbacks on your models for this.\r\n\r\nAlso, if you want to do it in controller, you can override in your controller column_value_from_param_value:\r\n\r\n```ruby\r\ndef column_value_from_param_value(*)\r\n  v = super\r\n  v.strip! if v.is_a? String\r\n  v\r\nend\r\n```"}}