Guest User

Untitled

a guest
Jul 23rd, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. class Design < ActiveRecord::Base
  2. belongs_to :designable, :polymorphic => true, :touch => true
  3.  
  4. def width
  5. 600
  6. end
  7.  
  8. def height
  9. 600
  10. end
  11. end
  12.  
  13. ## How to override width/height when design is associated? Smth like this:
  14.  
  15. class Tee < ActiveRecord::Base
  16. has_one :front_design, :class_name => 'Design', :as => 'designable' do
  17. def proxy_target.width
  18. 400
  19. end
  20.  
  21. def proxy_target.height
  22. 500
  23. end
  24. end
  25. end
Add Comment
Please, Sign In to add comment