Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Design < ActiveRecord::Base
- belongs_to :designable, :polymorphic => true, :touch => true
- def width
- 600
- end
- def height
- 600
- end
- end
- ## How to override width/height when design is associated? Smth like this:
- class Tee < ActiveRecord::Base
- has_one :front_design, :class_name => 'Design', :as => 'designable' do
- def proxy_target.width
- 400
- end
- def proxy_target.height
- 500
- end
- end
- end
Add Comment
Please, Sign In to add comment