Guest User

Untitled

a guest
Jun 25th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. class Post < ActiveRecord::Base
  2.  
  3. ...
  4.  
  5. private
  6.  
  7. ransacker :status, formatter: proc { |value|
  8. sym = Post.statuses_i18n.invert[value|]
  9. if sym.blank?
  10. raise "unexpected status accessed: #{value}"
  11. else
  12. sym
  13. end
  14. } do |parent|
  15. parent.table[:status]
  16. end
  17.  
  18. ...
  19.  
  20. end
Add Comment
Please, Sign In to add comment