Class: CustomFields::Model::CustomField
- Inherits:
-
Sequel::Model
- Object
- Sequel::Model
- CustomFields::Model::CustomField
- Includes:
- Zen::Model::Helper
- Defined in:
- lib/zen/package/custom_fields/lib/custom_fields/model/custom_field.rb
Overview
Model for managing retrieving custom fields.
Constant Summary
Constant Summary
Constants included from Zen::Model::Helper
Zen::Model::Helper::NoRegexpSupport
Class Method Summary (collapse)
-
+ (Mixed) search(query)
Searches for a set of custom fields.
Instance Method Summary (collapse)
-
- (Object) validate
Validates rules used whenever the model is created or saved.
Methods included from Zen::Model::Helper
Methods inherited from Sequel::Model
Class Method Details
+ (Mixed) search(query)
Searches for a set of custom fields.
28 29 30 |
# File 'lib/zen/package/custom_fields/lib/custom_fields/model/custom_field.rb', line 28 def self.search(query) return filter(search_column(:name, query)) end |
Instance Method Details
- (Object) validate
Validates rules used whenever the model is created or saved.
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/zen/package/custom_fields/lib/custom_fields/model/custom_field.rb', line 37 def validate validates_presence([ :name, :format, :custom_field_group_id, :custom_field_type_id ]) validates_max_length(255, [:name, :slug]) validates_type(TrueClass, [:required, :text_editor]) validates_integer([ :sort_order, :textarea_rows, :text_limit, :custom_field_group_id, :custom_field_type_id ]) validates_presence(:slug) unless new? validates_unique(:slug) end |