Hey, I'm currently working on a project combining Spree and Refinery. Spree suggests that many modifications are made using what they call decorators:
Refinery::Page.class_eval do def autocomplete_label title end attr_accessible :spree_taxon_id has_one :spree_taxon end
It works great. But what is the difference between simply opening a class and directly adding methods?
class Refinery::Page def autocomplete_label title end attr_accessible :spree_taxon_id has_one :spree_taxon end
I can understand that the first can be used when the class is unknown before runtime (which is not required for this use case). Are there any other differences?
source share