Module: Lrcat::Catalog

Defined in:
lib/lrcat/catalog.rb,
lib/lrcat/catalog/lens.rb,
lib/lrcat/catalog/image.rb,
lib/lrcat/catalog/library_file.rb,
lib/lrcat/catalog/camera_model.rb,
lib/lrcat/catalog/camera_serial.rb,
lib/lrcat/catalog/exif_metadata.rb,
lib/lrcat/catalog/library_folder.rb,
lib/lrcat/catalog/develop_settings.rb,
lib/lrcat/catalog/library_root_folder.rb,
lib/lrcat/catalog/additional_metadata.rb

Overview

The Catalog module takes care of the ActiveRecord connection and contains the ActiveRecord models.

Defined Under Namespace

Classes: AdditionalMetadata, CameraModel, CameraSerial, DevelopSettings, ExifMetadata, Image, Lens, LibraryFile, LibraryFolder, LibraryRootFolder

Class Method Summary collapse

Class Method Details

.closeObject

Close the connection.


32
33
34
# File 'lib/lrcat/catalog.rb', line 32

def self.close
  ActiveRecord::Base.remove_connection
end

.get_modelsArray<Symbol>

Get a list of the available models.


39
40
41
# File 'lib/lrcat/catalog.rb', line 39

def self.get_models
  self.constants.select { |c| Class === self.const_get(c) }
end

.open(path) ⇒ Object

Establish the connection to the catalog.


27
28
29
# File 'lib/lrcat/catalog.rb', line 27

def self.open(path)
  ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: path)
end