Module: ActiveScaffold::Bridges::SemanticAttributes::Column

Defined in:
lib/active_scaffold/bridges/semantic_attributes/column.rb

Instance Method Summary collapse

Instance Method Details

#initialize(name, active_record_class) ⇒ Object


3
4
5
6
7
8
9
10
11
# File 'lib/active_scaffold/bridges/semantic_attributes/column.rb', line 3

def initialize(name, active_record_class)
  super
  self.required = !active_record_class.semantic_attributes[self.name].predicates.find { |p| p.allow_empty? == false }.nil?
  active_record_class.semantic_attributes[self.name].predicates.find do |p|
    sem_type = p.class.to_s.split('::')[1].underscore.to_sym
    next if %i[required association].include?(sem_type)
    @form_ui = sem_type
  end
end