Sha256: 6cee0b7b74b9fd7e11781107e8dbae94e7a9eaaa72cf5dbd784747cb63577f65
Contents?: true
Size: 1.04 KB
Versions: 63
Compression:
Stored size: 1.04 KB
Contents
require_relative 'utils/associations' module CmAdmin module Models class Field include Utils::Associations attr_accessor :field_name, :label, :header, :field_type, :format, :precision, :height, :width, :helper_method, :preview, :custom_link, :prefix, :suffix, :tag_class, :display_if, :association_name, :association_type, :col_size def initialize(field_name, attributes = {}) @field_name = field_name set_default_values attributes.each do |key, value| self.send("#{key.to_s}=", value) end self.height = 50 if self.field_type == :image && self.height.nil? self.width = 50 if self.field_type == :image && self.width.nil? self.display_if = lambda { |arg| return true } if self.display_if.nil? validation_for_association end def set_default_values self.precision = 2 self.tag_class = {} self.col_size = nil self.field_type = :string self.label = field_name.to_s.titleize end end end end
Version data entries
63 entries across 63 versions & 1 rubygems