Module: Kiss::SequelDatabase
- Defined in:
- lib/kiss/ext/sequel_database.rb
Overview
This module is included into Sequel database class to provide Kiss-specific fnctionality to database objects.
Class Method Summary collapse
Instance Method Summary collapse
-
#evolution_number ⇒ Object
Returns app’s current evolution number.
-
#evolution_number=(version) ⇒ Object
Sets app’s current evolution number.
-
#evolution_number_table ⇒ Object
Creates evolution_number table if it does not exist.
-
#last_query ⇒ Object
:nodoc:.
Class Method Details
.append_features(mod) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/kiss/ext/sequel_database.rb', line 6 def self.append_features(mod) mod.class_eval do alias_method :execute_old, :execute _attr_accessor :kiss_controller, :kiss_request, :kiss_model_cache def execute(sql, *args, &block) #:nodoc: @_last_query = sql execute_old(sql, *args, &block) end end super end |
Instance Method Details
#evolution_number ⇒ Object
Returns app’s current evolution number.
38 39 40 |
# File 'lib/kiss/ext/sequel_database.rb', line 38 def evolution_number evolution_number_table.first.version end |
#evolution_number=(version) ⇒ Object
Sets app’s current evolution number.
43 44 45 |
# File 'lib/kiss/ext/sequel_database.rb', line 43 def evolution_number=(version) evolution_number_table.update(:version => version) end |
#evolution_number_table ⇒ Object
Creates evolution_number table if it does not exist.
27 28 29 30 31 32 33 34 35 |
# File 'lib/kiss/ext/sequel_database.rb', line 27 def evolution_number_table unless self.table_exists?(:evolution_number) self.create_table :evolution_number do column :version, :integer, :null=> false end self[:evolution_number].insert(:version => 0) end self[:evolution_number] end |
#last_query ⇒ Object
:nodoc:
20 21 22 |
# File 'lib/kiss/ext/sequel_database.rb', line 20 def last_query #:nodoc: @_last_query end |