Guest User

Untitled

a guest
Jun 21st, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. ## Setup
  2.  
  3. class Address
  4.  
  5. attr_accessor :id, :created_at, :line_one, :updated_at, :line_two, :tag
  6.  
  7. end
  8.  
  9. exclude = %w(id created_at updated_at tag)
  10.  
  11. a = Address
  12. # Assign some attrs
  13.  
  14. b = Address
  15. # Assign some attrs
  16.  
  17. ## Problem
  18.  
  19. a.attributes.except(exclude) == b.attributes.except(exclude)
  20.  
  21. # Because Except takes a splat, it's not smart enough to ... join, the array
  22. # into a comma separated list of args?
  23.  
  24. def except(*vals)
  25. ..... something about a hash.reject ;)
  26. end
Add Comment
Please, Sign In to add comment