Module: Mack::Database
- Defined in:
- lib/mack-orm/database.rb,
lib/mack-orm/paginator.rb,
lib/mack-orm/generators.rb,
lib/mack-orm/database_migrations.rb
Defined Under Namespace
Modules: Generators, Migrations Classes: Paginator
Class Method Summary collapse
-
.clear_connection(env = Mack.env) ⇒ Object
Clears connections to the database.
-
.create(env = Mack.env, repis = :default) ⇒ Object
Creates a database, if it doesn’t already exist for the specified environment.
-
.drop(env = Mack.env, repis = :default) ⇒ Object
Drops a database, if it exists for the specified environment.
-
.dump_structure(env = Mack.env, repis = :default) ⇒ Object
Dumps the structure of the database to a file.
-
.establish_connection(env = Mack.env) ⇒ Object
Sets up and establishes connections to the database based on the specified environment and the settings in the database.yml file.
-
.load_structure(file, env = Mack.env, repis = :default) ⇒ Object
Loads the structure of the given file into the database.
-
.paginate(klass, options = {}, query_options = {}) ⇒ Object
Creates a new Mack::Database::Paginator class and calls the paginate method on it.
-
.recreate(env = Mack.env, repis = :default) ⇒ Object
Drops and then creates the database.
Class Method Details
.clear_connection(env = Mack.env) ⇒ Object
Clears connections to the database
11 12 13 |
# File 'lib/mack-orm/database.rb', line 11 def self.clear_connection(env = Mack.env) raise NoMethodError.new(:clear_connection) end |
.create(env = Mack.env, repis = :default) ⇒ Object
Creates a database, if it doesn’t already exist for the specified environment
16 17 18 |
# File 'lib/mack-orm/database.rb', line 16 def self.create(env = Mack.env, repis = :default) raise NoMethodError.new(:create) end |
.drop(env = Mack.env, repis = :default) ⇒ Object
Drops a database, if it exists for the specified environment
21 22 23 |
# File 'lib/mack-orm/database.rb', line 21 def self.drop(env = Mack.env, repis = :default) raise NoMethodError.new(:drop) end |
.dump_structure(env = Mack.env, repis = :default) ⇒ Object
Dumps the structure of the database to a file.
37 38 39 |
# File 'lib/mack-orm/database.rb', line 37 def self.dump_structure(env = Mack.env, repis = :default) raise NoMethodError.new(:dump_structure) end |
.establish_connection(env = Mack.env) ⇒ Object
Sets up and establishes connections to the database based on the specified environment and the settings in the database.yml file.
6 7 8 |
# File 'lib/mack-orm/database.rb', line 6 def self.establish_connection(env = Mack.env) raise NoMethodError.new(:establish_connection) end |
.load_structure(file, env = Mack.env, repis = :default) ⇒ Object
Loads the structure of the given file into the database
32 33 34 |
# File 'lib/mack-orm/database.rb', line 32 def self.load_structure(file, env = Mack.env, repis = :default) raise NoMethodError.new(:load_structure) end |
.paginate(klass, options = {}, query_options = {}) ⇒ Object
Creates a new Mack::Database::Paginator class and calls the paginate method on it.
5 6 7 8 |
# File 'lib/mack-orm/paginator.rb', line 5 def self.paginate(klass, = {}, = {}) paginator = Mack::Database::Paginator.new(klass, , ) paginator.paginate end |