Class: Sorcery::Adapters::BaseAdapter

Inherits:
Object
  • Object
show all
Defined in:
lib/sorcery/adapters/base_adapter.rb

Direct Known Subclasses

ActiveRecordAdapter

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(model) ⇒ BaseAdapter

Returns a new instance of BaseAdapter.



4
5
6
# File 'lib/sorcery/adapters/base_adapter.rb', line 4

def initialize(model)
  @model = model
end

Class Method Details

.delete_allObject



13
14
15
# File 'lib/sorcery/adapters/base_adapter.rb', line 13

def self.delete_all
  @klass.delete_all
end

.find(id) ⇒ Object



17
18
19
# File 'lib/sorcery/adapters/base_adapter.rb', line 17

def self.find(id)
  find_by_id(id)
end

.from(klass) ⇒ Object



8
9
10
11
# File 'lib/sorcery/adapters/base_adapter.rb', line 8

def self.from(klass)
  @klass = klass
  self
end

Instance Method Details

#increment(field) ⇒ Object



21
22
23
# File 'lib/sorcery/adapters/base_adapter.rb', line 21

def increment(field)
  @model.increment(field)
end

#update_attribute(name, value) ⇒ Object



25
26
27
# File 'lib/sorcery/adapters/base_adapter.rb', line 25

def update_attribute(name, value)
  update_attributes(name => value)
end