Method: CounterCulture::Counter#first_level_relation_foreign_key
- Defined in:
- lib/counter_culture/counter.rb
#first_level_relation_foreign_key ⇒ Object
gets the foreign key name of the relation. will look at the first level only – i.e., if passed an array will consider only its first element
relation: a symbol or array of symbols; specifies the relation
that has the counter cache column
257 258 259 260 |
# File 'lib/counter_culture/counter.rb', line 257 def first_level_relation_foreign_key first_relation = relation.first if relation.is_a?(Enumerable) relation_reflect(first_relation).foreign_key end |