Module: Likeable::DefaultAdapter

Defined in:
lib/likeable/adapters/default_adapter.rb

Class Method Summary collapse

Class Method Details

.cast_idObject


3
4
5
# File 'lib/likeable/adapters/default_adapter.rb', line 3

def self.cast_id
  lambda { |id| id.to_i }
end

.find_manyObject


13
14
15
16
17
# File 'lib/likeable/adapters/default_adapter.rb', line 13

def self.find_many
  lambda { |klass, ids|
    klass.where(:id => ids)
  }
end

.find_oneObject


7
8
9
10
11
# File 'lib/likeable/adapters/default_adapter.rb', line 7

def self.find_one
  lambda { |klass, id|
    klass.where(:id => id).first
  }
end