code_junkie

How should Rails models containing database and non-database datasources be broken up?

Nov 10th, 2011
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. class Product < ActiveRecord::Base
  2. has_one :aws_item
  3. end
  4. class AWSItem
  5. belongs_to :product
  6. end
  7.  
  8. class Product < ActiveRecord::Base
  9. end
  10. class AWSItem < Product
  11. def do_amazon_stuff
  12. ...
  13. end
  14. end
  15.  
  16. class Product < ActiveRecord::Base
  17.  
  18. end
  19.  
  20. class ItemFetcher < BackgrounDRb::Rails
  21. def do_work
  22. # .... Make a cached copy of your ECS catalog here.
  23. # Copy the Amazon stuff into your local model
  24. end
  25. end
Add Comment
Please, Sign In to add comment