The validation reflection plugin adds three things (1) Reflective access to validations - ModelClass.reflect_on_all_validations - ModelClass.reflect_on_validations_for(:property) (2) It provides "declarative" methods for defining validations based on database metadata - validates_presence_of_mandatory_content_columns - validates_lengths_of_string_attributes - validates_all_associated (3) It reflects validation information into the class attributes of of HTML elements generated from rhtml templates. See test/instance_tag_validations_test.rb for what this looks like. Yes, for validates_format_of it gets nasty. Installation: $ script/plugin install \ http://www.schuerig.de/michael/rails/validation_reflection Michael -- Michael Schuerig mailto:michael@schuerig.de http://www.schuerig.de/michael/
> $ script/plugin install \ > http://www.schuerig.de/michael/rails/validation_reflectionGreat work Micheal. Cheers Nic -- Posted via http://www.ruby-forum.com/.
On Saturday 29 July 2006 09:06, Dr Nic wrote:> > $ script/plugin install \ > > http://www.schuerig.de/michael/rails/validation_reflection > > Great work Micheal.Thanks. I had the functionality lying around for more than a year as part of my BoilerPlate project. But as that project is all but dead, I intend to release some of its reusable functionality in the form of plugins. Michael -- Michael Schuerig mailto:michael@schuerig.de http://www.schuerig.de/michael/
Nice one. Just what I need. -- Dan Webb http://www.danwebb.net
On Sunday 30 July 2006 13:12, Dan Webb wrote:> Nice one. Just what I need.If you want to use this for client-side validation, have a look at my almost purely declarative validator at http://www.schuerig.de/michael/javascript/ It is, unfortunately, based on an earlier version of Prototype and my own support code probably clashes with current the Prototype lib. I intend to rectify this some time and bundle the stuff in a plugin. Alas, I don''t have the time right now to do it right. Michael -- Michael Schuerig mailto:michael@schuerig.de http://www.schuerig.de/michael/