Class: Spectacles::View

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/spectacles/view.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.newObject



5
6
7
8
# File 'lib/spectacles/view.rb', line 5

def self.new(*)
  warn "DEPRECATION WARNING: #{self} is an abstract class and should not be instantiated. In v1.0, calling `#{self}.new` will raise a NotImplementedError."
  super # raise NotImplementedError, "#{self} is an abstract class and can not be instantiated."
end

.view_exists?Boolean Also known as: table_exists?

Returns:

  • (Boolean)


10
11
12
# File 'lib/spectacles/view.rb', line 10

def self.view_exists?
  self.connection.view_exists?(self.view_name)
end

Instance Method Details

#==(comparison_object) ⇒ Object



19
20
21
22
23
24
# File 'lib/spectacles/view.rb', line 19

def ==(comparison_object)
  super ||
    comparison_object.instance_of?(self.class) &&
    attributes.present? &&
    comparison_object.attributes == attributes
end

#persisted?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/spectacles/view.rb', line 26

def persisted?
  false
end

#readonly?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/spectacles/view.rb', line 30

def readonly?
  true
end