Module: Ransack::Nodes::Bindable
Instance Attribute Summary collapse
-
#attr_name ⇒ Object
Returns the value of attribute attr_name.
-
#parent ⇒ Object
Returns the value of attribute parent.
Instance Method Summary collapse
- #attr ⇒ Object (also: #arel_attribute)
- #bound? ⇒ Boolean
- #klass ⇒ Object
- #ransacker ⇒ Object
- #reset_binding! ⇒ Object
Instance Attribute Details
#attr_name ⇒ Object
Returns the value of attribute attr_name.
5 6 7 |
# File 'lib/ransack/nodes/bindable.rb', line 5 def attr_name @attr_name end |
#parent ⇒ Object
Returns the value of attribute parent.
5 6 7 |
# File 'lib/ransack/nodes/bindable.rb', line 5 def parent @parent end |
Instance Method Details
#attr ⇒ Object Also known as: arel_attribute
7 8 9 |
# File 'lib/ransack/nodes/bindable.rb', line 7 def attr @attr ||= ransacker ? ransacker.attr_from(self) : context.table_for(parent)[attr_name] end |
#bound? ⇒ Boolean
20 21 22 |
# File 'lib/ransack/nodes/bindable.rb', line 20 def bound? attr_name.present? && parent.present? end |
#klass ⇒ Object
16 17 18 |
# File 'lib/ransack/nodes/bindable.rb', line 16 def klass @klass ||= context.klassify(parent) end |
#ransacker ⇒ Object
12 13 14 |
# File 'lib/ransack/nodes/bindable.rb', line 12 def ransacker klass._ransackers[attr_name] end |
#reset_binding! ⇒ Object
24 25 26 |
# File 'lib/ransack/nodes/bindable.rb', line 24 def reset_binding! @parent = @attr_name = @attr = @klass = nil end |