Class: ParamsReady::Helpers::ArelBuilder::Attribute::Literal

Inherits:
Literal
  • Object
show all
Defined in:
lib/params_ready/helpers/arel_builder.rb

Instance Method Summary collapse

Constructor Details

#initialize(literal, arel_table) ⇒ Literal

Returns a new instance of Literal.



73
74
75
76
# File 'lib/params_ready/helpers/arel_builder.rb', line 73

def initialize(literal, arel_table)
  super literal
  @arel_table = arel_table
end

Instance Method Details

#to_arel(default_table, *args) ⇒ Object



78
79
80
81
82
83
84
85
# File 'lib/params_ready/helpers/arel_builder.rb', line 78

def to_arel(default_table, *args)
  arel_table = @arel_table || default_table
  if arel_table == :none
    super(*args)
  else
    arel_table[@literal]
  end
end