Sha256: acf9fa7f9d4f0bfd2c0a380c056dff83efd7aaa88dc802cab3b1630a0bffb48f

Contents?: true

Size: 833 Bytes

Versions: 29

Compression:

Stored size: 833 Bytes

Contents

class ActiveScaffold::Bridges::SemanticAttributes
  module Column
    def self.included(base)
      base.class_eval { alias_method_chain :initialize, :semantic_attributes }
    end

    def initialize_with_semantic_attributes(name, active_record_class)
      initialize_without_semantic_attributes(name, active_record_class)
      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 [:required, :association].include?(sem_type)
        @form_ui = sem_type
      end
    end
  end
end
ActiveScaffold::DataStructures::Column.class_eval do
  include ActiveScaffold::Bridges::SemanticAttributes::Column
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
active_scaffold-3.4.24 lib/active_scaffold/bridges/semantic_attributes/column.rb
active_scaffold-3.4.23 lib/active_scaffold/bridges/semantic_attributes/column.rb
active_scaffold-3.4.22 lib/active_scaffold/bridges/semantic_attributes/column.rb
active_scaffold-3.4.21.1 lib/active_scaffold/bridges/semantic_attributes/column.rb
active_scaffold-3.4.21 lib/active_scaffold/bridges/semantic_attributes/column.rb
active_scaffold-3.4.20 lib/active_scaffold/bridges/semantic_attributes/column.rb
active_scaffold-3.4.19 lib/active_scaffold/bridges/semantic_attributes/column.rb
active_scaffold-3.4.18.1 lib/active_scaffold/bridges/semantic_attributes/column.rb
active_scaffold-3.4.18 lib/active_scaffold/bridges/semantic_attributes/column.rb