Class: Multitenant::List
- Inherits:
-
Object
- Object
- Multitenant::List
- Defined in:
- lib/generators/multitenant/views_and_triggers/list/list.rb
Instance Attribute Summary collapse
-
#sql ⇒ Object
Returns the value of attribute sql.
Instance Method Summary collapse
- #exists?(name) ⇒ Boolean
-
#initialize(sql = nil) ⇒ List
constructor
A new instance of List.
- #to_a ⇒ Object
Constructor Details
#initialize(sql = nil) ⇒ List
Returns a new instance of List.
5 6 7 |
# File 'lib/generators/multitenant/views_and_triggers/list/list.rb', line 5 def initialize(sql = nil) @sql = sql end |
Instance Attribute Details
#sql ⇒ Object
Returns the value of attribute sql.
3 4 5 |
# File 'lib/generators/multitenant/views_and_triggers/list/list.rb', line 3 def sql @sql end |
Instance Method Details
#exists?(name) ⇒ Boolean
13 14 15 |
# File 'lib/generators/multitenant/views_and_triggers/list/list.rb', line 13 def exists?(name) to_a.include?(name) end |
#to_a ⇒ Object
9 10 11 |
# File 'lib/generators/multitenant/views_and_triggers/list/list.rb', line 9 def to_a ActiveRecord::Base.connection.execute(sql).to_a.flatten end |