search for: template_field

Displaying 2 results from an estimated 2 matches for "template_field".

2006 Apr 11
1
Mixins?
...s that I wanted to push into a helper. Now I reckoned that the Ruby way was to create a module and mix it in with include. However, I can''t get it to work <frustration> In the first instance I put it straight into the models directory: module FieldHelper def validate_field if template_field.mandatory? && (!field_value || field_value.length==0) errors.add(template_field.name, _(''cant.be.blank'')) end end end Now in the model I have this : require "field_helper" class SchemeAccountField < ActiveRecord::Base include FieldHelper pr...
2009 Apr 20
0
User defined model and validations?
...d then x many fields of say "Text max length 20 chars", "Image size 50x50", "Text 10 chars, not required" etc. - After the template is defined, end user would load it and save implementations of that template. The template would be easy to create say template has_many template_fields. But how can I load this template, validate it''s data and save the instances in another table(s)? This would be similar to say allowing the admin to define their own forms/fields/validations in the database, then saving instances of these forms. It seems like this would be a fairly com...