| Issue 11: | Substruct should have an easy way to deprecate methods. | |
| 1 person starred this issue and may be notified of changes. | Back to list |
Here goes some methods to help to deprecate things. (I borrowed from typo: http://typosphere.org/) Its very simple and will let make things like that: #Defined to save tags from product edit view def tags=(list) substruct_deprecated "Use tag_ids= instead." tags.clear for id in list tags << Tag.find(id) if !id.empty? end end # Defined to save tags from product edit view def tag_ids=(list) tags.clear for id in list tags << Tag.find(id) if !id.empty? end end Or even better: substruct_deprecate :tags= => :tag_ids= # Defined to save tags from product edit view def tag_ids=(list) tags.clear for id in list tags << Tag.find(id) if !id.empty? end end And the old method will be auto-generated with a warning at the beginning and pointing to the new one. Very clever. It can be put at /lib in plugins and should be required wherever you think is better. Regards.
Apr 9, 2008
Added into /vendor/plugins/substruct/lib in revision 73. Please propose a patch for including and deprecating methods so I can see it in use.
Apr 9, 2008
I already did, its the next one, issue 12
Apr 9, 2008
Yep just saw that...thanks, included and closed. Fixed up some tests as well.
Apr 9, 2008
If the issue 12 was fixed, this one must be fixed too as one depends on the other. I updated my working copy and I saw that this one is already there, just close it.
Apr 9, 2008
Sorry guess I forgot to close this one :)
Status:
fixed
Owner: subimage |
Labels: -Priority-Medium Priority-Low