apotonick/reform — pull request #64 by scharfie (2014-02-04 00:45:42+00:00)
Title: allow inline nested property to be inherited from superclass using new :inherited option

This PR allows nested property objects to be inherited from superclass and enhanced. The primary motivation for this was to allow subclasses to effectively re-open a nested property of the superclass and add validations. A contrived example:

```
class RegistrationForm < Reform::Form
property :contact do
property :first_name
property :last_name
property :email
validates :email, :presence => true
end
end

class UpdateRegistrationForm < RegistrationForm
property :contact, :inherit => true do
property :previous_email, :virtual => true
validates :previous_email, :presence => true
end
end
```

Instances of UpdateRegistrationForm will now have a contact property consisting of all properties and validations defined in both RegistrationForm and UpdateRegistrationForm.

Note that right now I've added a new :inherit option which must be set to `true` for the subclass to inherit the property from the parent class. By default :inherit is assumed to be false, so the behavior is not affected implicitly. If this PR is considered useful, I am open to using a different naming strategy.

Note: I realize that the property method actually comes from the representable gem, so if it's more appropriate to create a patch there instead I can try that.