Advertisement
Guest User

Untitled

a guest
May 25th, 2016
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. module ActiveRecordRepository
  2. class ItemRepository
  3. def model_class
  4. ActiveRecordRepository::Item
  5. end
  6.  
  7. def new_item(item_details = {})
  8. model_class.new(item_details)
  9. end
  10.  
  11. def save(item)
  12. item.save
  13. end
  14.  
  15. def all
  16. model_class.all
  17. end
  18.  
  19. def find_by(name)
  20. model_class.find_by(name)
  21. end
  22.  
  23. end
  24. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement