Class: LooseTightDictionary::CachedResult
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- LooseTightDictionary::CachedResult
- Defined in:
- lib/loose_tight_dictionary/cached_result.rb
Defined Under Namespace
Modules: ActiveRecordBaseExtension
Class Method Summary collapse
Class Method Details
.create_table ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/loose_tight_dictionary/cached_result.rb', line 5 def self.create_table connection.create_table :loose_tight_dictionary_cached_results do |t| t.string :a_class t.string :a t.string :b_class t.string :b end connection.add_index :loose_tight_dictionary_cached_results, [:a_class, :b_class, :a], :name => 'aba' connection.add_index :loose_tight_dictionary_cached_results, [:a_class, :b_class, :b], :name => 'abb' connection.add_index :loose_tight_dictionary_cached_results, [:a_class, :b_class, :a, :b], :name => 'abab' reset_column_information end |
.setup(from_scratch = false) ⇒ Object
18 19 20 21 |
# File 'lib/loose_tight_dictionary/cached_result.rb', line 18 def self.setup(from_scratch = false) connection.drop_table :loose_tight_dictionary_cached_results if from_scratch and table_exists? create_table unless table_exists? end |