Class: Pickle::Adapter::Fabrication
- Inherits:
-
Pickle::Adapter
- Object
- Pickle::Adapter
- Pickle::Adapter::Fabrication
- Defined in:
- lib/pickle/adapter.rb
Overview
fabrication adapter
Instance Attribute Summary
Attributes inherited from Pickle::Adapter
Class Method Summary (collapse)
Instance Method Summary (collapse)
- - (Object) create(attrs = {})
-
- (Fabrication) initialize(factory)
constructor
A new instance of Fabrication.
Methods inherited from Pickle::Adapter
column_names, create_model, find_all_models, find_first_model, get_model, model_classes
Constructor Details
- (Fabrication) initialize(factory)
A new instance of Fabrication
146 147 148 149 150 |
# File 'lib/pickle/adapter.rb', line 146 def initialize(factory) if defined? ::Fabrication @klass, @name = factory[1].klass, factory[0].to_s end end |
Class Method Details
+ (Object) factories
137 138 139 140 141 142 143 144 |
# File 'lib/pickle/adapter.rb', line 137 def self.factories if defined? ::Fabrication ::Fabrication::Support.find_definitions if ::Fabrication::Fabricator.schematics.empty? ::Fabrication::Fabricator.schematics.collect{|v| new(v)} else [] end end |
Instance Method Details
- (Object) create(attrs = {})
152 153 154 155 156 157 158 |
# File 'lib/pickle/adapter.rb', line 152 def create(attrs = {}) if defined? ::Fabrication ::Fabrication::Fabricator.generate(@name.to_sym, { :save => true }, attrs) end end |