class ActiveFacts::Composition::Traits::Rails::Component
Public Instance Methods
name()
click to toggle source
# File lib/activefacts/compositions/traits/rails.rb, line 73 def name ACTR::singular_name(@base.name) end
plural_name()
click to toggle source
# File lib/activefacts/compositions/traits/rails.rb, line 77 def plural_name ACTR::plural_name(@base.name) end
type()
click to toggle source
# File lib/activefacts/compositions/traits/rails.rb, line 81 def type type_name, params, constraints = *explode.type() rails_type = case type_name when /^Auto ?Counter$/i 'serial' # REVISIT: Need to detect surrogate ID fields and handle them correctly when /^[Ug]uid$/i 'uuid' when /^Unsigned ?Integer$/i, /^Integer$/i, /^Signed ?Integer$/i, /^Unsigned ?Small ?Integer$/i, /^Signed ?Small ?Integer$/i, /^Unsigned ?Tiny ?Integer$/i length = nil 'integer' when /^Decimal$/i 'decimal' when /^Float$/i, /^Double$/i, /^Real$/i 'float' when /^Fixed ?Length ?Text$/i, /^Char$/i 'string' when /^Variable ?Length ?Text$/i, /^String$/i 'string' when /^Large ?Length ?Text$/i, /^Text$/i 'text' when /^Date ?And ?Time$/i, /^Date ?Time$/i 'datetime' when /^Date$/i 'date' when /^Time$/i 'time' when /^Auto ?Time ?Stamp$/i 'timestamp' when /^Money$/i 'decimal' when /^Picture ?Raw ?Data$/i, /^Image$/i, /^Variable ?Length ?Raw ?Data$/i, /^Blob$/i 'binary' when /^BIT$/i, /^Boolean$/i 'boolean' else type_name # raise "ActiveRecord type unknown for standard type #{type}" end [rails_type, params[:length]] end