HomeRamblings  ⁄  ruby block

ruby block

DRYing your Views

Let me start out by saying that I am finally beginning to understand a bit about that magical Ruby block notion and how implementing methods through block passing can really empower you as a Ruby developer. Thanks to, a most excellent [Ruby tutorial][1], I am definitely feeling a good bit more empowered about getting my Views in Rails all DRY'd up. The problem: I wanted to introduce a property editor metaphor for the website I'm working on where properties could expose edit forms for just about any situation, much like wordpress' widget interface does. That is, there's an area of the current page that shows basic information about the property in a read-only (and preferably compact) form, and user could click an "edit" button and exposed an editable version of the properties. The "edit" link becomes a "cancel" link, which,… read more