Class: Pickle::Adapter::Orm
- Inherits:
-
Pickle::Adapter
- Object
- Pickle::Adapter
- Pickle::Adapter::Orm
- Defined in:
- lib/pickle/adapter.rb
Overview
ORM adapter. If you have no factory adapter, you can use this adapter to use your orm as ‘factory’ - ie create objects
Instance Attribute Summary
Attributes inherited from Pickle::Adapter
Class Method Summary collapse
Instance Method Summary collapse
- #create(attrs = {}) ⇒ Object
-
#initialize(klass) ⇒ Orm
constructor
A new instance of Orm.
Methods inherited from Pickle::Adapter
column_names, create_model, find_all_models, find_first_model, get_model, model_classes
Constructor Details
#initialize(klass) ⇒ Orm
Returns a new instance of Orm.
128 129 130 |
# File 'lib/pickle/adapter.rb', line 128 def initialize(klass) @klass, @name = klass, klass.name.underscore.gsub('/','_') end |
Class Method Details
.factories ⇒ Object
124 125 126 |
# File 'lib/pickle/adapter.rb', line 124 def self.factories model_classes.map{|k| new(k)} end |
Instance Method Details
#create(attrs = {}) ⇒ Object
132 133 134 |
# File 'lib/pickle/adapter.rb', line 132 def create(attrs = {}) Pickle::Adapter.create_model(@klass, attrs) end |