class Bhf::Platform::Attribute::Reflection
Attributes
info[R]
name[R]
title[R]
Public Class Methods
new(reflection, options = {})
click to toggle source
# File lib/bhf/platform/attribute/reflection.rb, line 6 def initialize(reflection, options = {}) @name = reflection.name.to_s @title = options[:title] @info = options[:info] @reflection = reflection @options_form_type = options[:form_type].to_sym if options[:form_type] @options_display_type = options[:display_type].to_sym if options[:display_type] @options_show_type = options[:show_type].to_sym if options[:show_type] @link_platform_settings = options[:link] unless options[:link].blank? @reorderble = options[:reorderble] end
Public Instance Methods
db_name()
click to toggle source
# File lib/bhf/platform/attribute/reflection.rb, line 58 def db_name @reflection.foreign_key end
display_type()
click to toggle source
# File lib/bhf/platform/attribute/reflection.rb, line 30 def display_type @options_display_type || :default end
form_type()
click to toggle source
# File lib/bhf/platform/attribute/reflection.rb, line 26 def form_type type end
link()
click to toggle source
# File lib/bhf/platform/attribute/reflection.rb, line 66 def link return unless @link_platform_settings @link ||= Bhf::Platform::Base.new(@link_platform_settings) end
macro()
click to toggle source
# File lib/bhf/platform/attribute/reflection.rb, line 21 def macro return :has_and_belongs_to_many if @reflection.macro == :has_many && @reflection.options[:through] @reflection.macro end
reflection()
click to toggle source
# File lib/bhf/platform/attribute/reflection.rb, line 54 def reflection @reflection end
reorderble()
click to toggle source
# File lib/bhf/platform/attribute/reflection.rb, line 62 def reorderble @reorderble end
show_type()
click to toggle source
# File lib/bhf/platform/attribute/reflection.rb, line 38 def show_type @options_show_type || display_type end
type()
click to toggle source
# File lib/bhf/platform/attribute/reflection.rb, line 42 def type return @options_form_type if @options_form_type if macro == :has_and_belongs_to_many or macro == :has_many :check_box elsif macro == :belongs_to or macro == :has_one :select else :static end end
type_ignore_emtpy?()
click to toggle source
# File lib/bhf/platform/attribute/reflection.rb, line 34 def type_ignore_emtpy? false end