Hey I am currently working on a project that integrates Spree and Refinery. Spree suggests that many modifications are done 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
This works fine. But what is the difference between just opening up the class and adding the methods directly?
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 not known until runtime (which is not needed for this use case). Are there any other differences?