Class: ActiveRecord::Base
- Inherits:
-
Object
- Object
- ActiveRecord::Base
- Defined in:
- lib/empty_eye/active_record/base.rb
Class Method Summary collapse
-
.extended_with ⇒ Object
all data for mti class is stored here when empty it is not so MT-I.
-
.finder_needs_type_condition? ⇒ Boolean
we dont need no freakin’ finder the view handles this.
-
.mti_class(primary_table = nil) {|nil| ... } ⇒ Object
interface for building mti_class primary table is not necessary if the table named correctly (Bar => bars_core) OR if the class inherits a primary table simply wrap your greasy association in this block.
-
.mti_class? ⇒ Boolean
am i an mti class? easier than making a new class type …
-
.mti_primary_shard ⇒ Object
the class of primary shard.
Class Method Details
.extended_with ⇒ Object
all data for mti class is stored here when empty it is not so MT-I
30 31 32 |
# File 'lib/empty_eye/active_record/base.rb', line 30 def extended_with @extended_with ||= EmptyEye::ViewExtensionCollection.new(self) end |
.finder_needs_type_condition? ⇒ Boolean
we dont need no freakin’ finder the view handles this
41 42 43 |
# File 'lib/empty_eye/active_record/base.rb', line 41 def finder_needs_type_condition? !mti_class? and super end |
.mti_class(primary_table = nil) {|nil| ... } ⇒ Object
interface for building mti_class primary table is not necessary if the table named correctly (Bar => bars_core) OR if the class inherits a primary table simply wrap your greasy association in this block
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/empty_eye/active_record/base.rb', line 15 def mti_class(primary_table = nil) self.primary_key = "id" raise(EmptyEye::AlreadyExtended, "MTI class method already invoked") if mti_class? set_mti_primary_table(primary_table) self.table_name = compute_view_name extended_with.primary_table(mti_primary_table) before_yield = reflect_on_multiple_associations(:has_one) yield nil if block_given? mti_associations = reflect_on_multiple_associations(:has_one) - before_yield extend_mti_class(mti_associations) true end |
.mti_class? ⇒ Boolean
am i an mti class? easier than making a new class type … i tried
7 8 9 |
# File 'lib/empty_eye/active_record/base.rb', line 7 def mti_class? extended_with.any? end |
.mti_primary_shard ⇒ Object
the class of primary shard
35 36 37 |
# File 'lib/empty_eye/active_record/base.rb', line 35 def mti_primary_shard extended_with.primary.shard end |