Module: DaddysGirl::ActiveRecordModel
- Defined in:
- lib/daddys_girl.rb
Class Method Summary collapse
- .generate(attributes = {}) ⇒ Object
- .generate!(attributes = {}) ⇒ Object
- .spawn(attributes = {}) ⇒ Object
- .symbol ⇒ Object
Class Method Details
.generate(attributes = {}) ⇒ Object
8 9 10 |
# File 'lib/daddys_girl.rb', line 8 def generate(attributes = {}) FactoryGirl.create(self.symbol, attributes) end |
.generate!(attributes = {}) ⇒ Object
12 13 14 15 16 |
# File 'lib/daddys_girl.rb', line 12 def generate!(attributes = {}) FactoryGirl.create(self.symbol, attributes).tap do |obj| raise obj.errors.inspect unless obj.errors.empty? end end |
.spawn(attributes = {}) ⇒ Object
18 19 20 |
# File 'lib/daddys_girl.rb', line 18 def spawn(attributes = {}) FactoryGirl.build(self.symbol, attributes) end |
.symbol ⇒ Object
4 5 6 |
# File 'lib/daddys_girl.rb', line 4 def symbol self.name.underscore.to_sym end |