Class: Tuttle::Presenters::ActiveRecord::ReflectionPresenter
- Inherits:
-
BasePresenter
- Object
- SimpleDelegator
- BasePresenter
- Tuttle::Presenters::ActiveRecord::ReflectionPresenter
show all
- Defined in:
- lib/tuttle/presenters/active_record/reflection_presenter.rb
Instance Method Summary
collapse
#h, #initialize
Instance Method Details
#foreign_key ⇒ Object
44
|
# File 'lib/tuttle/presenters/active_record/reflection_presenter.rb', line 44
def foreign_key; super rescue 'Unknown' end
|
#inverse_of ⇒ Object
13
14
15
16
17
|
# File 'lib/tuttle/presenters/active_record/reflection_presenter.rb', line 13
def inverse_of
if has_inverse?
h.content_tag(:span, has_inverse?.inspect, class: options[:inverse_of].present? ? 'specified' : 'autodetected')
end
end
|
#macro ⇒ Object
10
|
# File 'lib/tuttle/presenters/active_record/reflection_presenter.rb', line 10
def macro; super.inspect end
|
#name ⇒ Object
9
|
# File 'lib/tuttle/presenters/active_record/reflection_presenter.rb', line 9
def name; super.inspect end
|
#options_autosave ⇒ Object
35
36
37
|
# File 'lib/tuttle/presenters/active_record/reflection_presenter.rb', line 35
def options_autosave
h.true_label(options[:autosave].present?, 'autosave')
end
|
#options_class_name ⇒ Object
33
|
# File 'lib/tuttle/presenters/active_record/reflection_presenter.rb', line 33
def options_class_name; options[:class_name] rescue 'Unknown' end
|
#options_dependent ⇒ Object
32
|
# File 'lib/tuttle/presenters/active_record/reflection_presenter.rb', line 32
def options_dependent; options[:dependent] rescue 'Unknown' end
|
#options_other ⇒ Object
46
47
48
49
|
# File 'lib/tuttle/presenters/active_record/reflection_presenter.rb', line 46
def options_other
other_options = options.except(:polymorphic, :dependent, :class_name, :autosave, :before_add, :before_remove)
other_options.inspect unless other_options.empty?
end
|
#options_required ⇒ Object
39
40
41
42
|
# File 'lib/tuttle/presenters/active_record/reflection_presenter.rb', line 39
def options_required
h.true_label(options[:required].present?, 'required')
end
|
#polymorphic? ⇒ Boolean
24
25
26
|
# File 'lib/tuttle/presenters/active_record/reflection_presenter.rb', line 24
def polymorphic?
h.true_label(super, 'polymorphic')
end
|
#scoped? ⇒ Boolean
19
20
21
22
|
# File 'lib/tuttle/presenters/active_record/reflection_presenter.rb', line 19
def scoped?
h.true_label(scope.present?, 'scoped')
end
|
#type ⇒ Object
11
|
# File 'lib/tuttle/presenters/active_record/reflection_presenter.rb', line 11
def type; super rescue 'Unknown' end
|
#validate? ⇒ Boolean
28
29
30
|
# File 'lib/tuttle/presenters/active_record/reflection_presenter.rb', line 28
def validate?
h.true_label(super, 'validate')
end
|