{"action":"closed","issue":{"url":"https://api.github.com/repos/activerecord-hackery/ransack/issues/587","labels_url":"https://api.github.com/repos/activerecord-hackery/ransack/issues/587/labels{/name}","comments_url":"https://api.github.com/repos/activerecord-hackery/ransack/issues/587/comments","events_url":"https://api.github.com/repos/activerecord-hackery/ransack/issues/587/events","html_url":"https://github.com/activerecord-hackery/ransack/issues/587","id":106656788,"number":587,"title":"Convert JSON or hstore attributes to an integer?","user":{"login":"jcohenho","id":912154,"avatar_url":"https://avatars.githubusercontent.com/u/912154?v=3","gravatar_id":"","url":"https://api.github.com/users/jcohenho","html_url":"https://github.com/jcohenho","followers_url":"https://api.github.com/users/jcohenho/followers","following_url":"https://api.github.com/users/jcohenho/following{/other_user}","gists_url":"https://api.github.com/users/jcohenho/gists{/gist_id}","starred_url":"https://api.github.com/users/jcohenho/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jcohenho/subscriptions","organizations_url":"https://api.github.com/users/jcohenho/orgs","repos_url":"https://api.github.com/users/jcohenho/repos","events_url":"https://api.github.com/users/jcohenho/events{/privacy}","received_events_url":"https://api.github.com/users/jcohenho/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-09-15T22:00:43Z","updated_at":"2015-09-16T21:17:08Z","closed_at":"2015-09-16T21:17:08Z","body":"I noticed in the Wiki the ability to convert an integer db field into a string in order to use a `cont` predicate.      ```\r\nransacker :id do\r\n  Arel.sql(\"to_char(id, '9999999')\")\r\nend```\r\n\r\nI am assuming ransack predicates are enabled based on the column type by default, but when it comes to json or hstore attributes they can't assume the type. Is it possible to convert an hstore or json attribute to an integer? What would this look like?\r\n I'm currently using the following ransacker for a json attribute but need to search with greater than and less than predicates:\r\n```\r\nransacker :order_amount do |parent|\r\n    Arel::Nodes::InfixOperation.new('->', parent.table[:order_payload], Arel::Nodes.build_quoted('order_amount'))\r\n  end\r\n```"}}