Module: ArelTableShortcut::ClassMethods
- Defined in:
- lib/arel_table_shortcut.rb
Overview
Class-level methods extended onto every including ActiveRecord class.
Instance Method Summary collapse
-
#[](column_name) ⇒ Arel::Attributes::Attribute
Model[:column]shortcut forModel.arel_table[:column].
Instance Method Details
#[](column_name) ⇒ Arel::Attributes::Attribute
Model[:column] shortcut for Model.arel_table[:column].
Written as an explicit method rather than delegate :[], to: :arel_table
because YARD's DSL handler crashes on delegate with an operator name.
column_name (Symbol or String) is the column to expose as an Arel
attribute. Aliased columns work because arel_table resolves them.
31 |
# File 'lib/arel_table_shortcut.rb', line 31 def [](column_name) = arel_table[column_name] # rubocop:disable Rails/Delegate -- YARD's DSL handler crashes on this delegate form |