Module: Meteorite

Defined in:
lib/meteorite/assets.rb,
lib/meteorite/version.rb,
lib/meteorite/bindings.rb,
lib/generators/meteorite/install_generator.rb

Defined Under Namespace

Modules: Rails Classes: InstallGenerator

Constant Summary collapse

VERSION =
"0.1.2"

Class Method Summary collapse

Class Method Details

.bind_key(object) ⇒ Object

get the unique bind key for an instance or collection of ActiveRecord models



3
4
5
6
7
8
9
10
11
12
13
# File 'lib/meteorite/bindings.rb', line 3

def self.bind_key(object)

  # if we're dealing with a collection
  if object.class.parent == ActiveRecord
    return "#{object.table_name}"
  # else if we're dealing with an object
  elsif object.class.parent == Object && object.respond_to?('id')
    return "#{object.class.name}-#{object.id}"
  end
  
end