code_junkie

Being as DRY as possible in a Ruby on Rails App

Nov 10th, 2011
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. class Asset < ActiveRecord::Base
  2. ... attachment_fu logic ...
  3. end
  4.  
  5. class Avatar < Asset
  6. ... avatar specific attachment_fu logic ...
  7. end
  8.  
  9. class PDF < Asset
  10. ... PDF specific attachment_fu logic ...
  11. end
  12.  
  13. class FileUpload < ActiveRecord::Base
  14. belongs_to :fileable, :polymorphic => true
  15. file_column :name
  16. end
  17.  
  18. class Company < ActiveRecord::Base
  19. has_many :file_uploads, :as => :fileable
  20. end
Add Comment
Please, Sign In to add comment