Module: ActsAsFerret::WithoutAR::ClassMethods

Defined in:
lib/acts_as_ferret/without_ar.rb

Instance Method Summary collapse

Instance Method Details

#countObject



37
38
39
# File 'lib/acts_as_ferret/without_ar.rb', line 37

def count
  0
end

#find(what, args = {}) ⇒ Object



25
26
27
28
29
30
31
32
33
# File 'lib/acts_as_ferret/without_ar.rb', line 25

def find(what, args = {})
  case what
  when :all
    ids = args[:conditions][1]
    ids.map { |id| find id }
  else
    find_for_id what
  end
end

#find_for_id(id) ⇒ Object

Raises:

  • (NotImplementedError)


34
35
36
# File 'lib/acts_as_ferret/without_ar.rb', line 34

def find_for_id(id)
  raise NotImplementedError.new("implement find_for_id in class #{self.name}")
end

#loggerObject



16
17
18
# File 'lib/acts_as_ferret/without_ar.rb', line 16

def logger
  RAILS_DEFAULT_LOGGER
end

#primary_keyObject



22
23
24
# File 'lib/acts_as_ferret/without_ar.rb', line 22

def primary_key
  'id'
end

#table_nameObject



19
20
21
# File 'lib/acts_as_ferret/without_ar.rb', line 19

def table_name
  self.name.underscore
end