Module: Modlr
- Defined in:
- lib/modlr.rb,
lib/modlr/names.rb,
lib/modlr/version.rb
Defined Under Namespace
Modules: Name
Constant Summary collapse
- VERSION =
"0.0.4.5.1"
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Object
modlr :class, number_of_records, => :type, :field => type If I have a User class, with fields name (string), and age (int), then ‘modlr :user, 100, => :name, :age => :age` will create 100 user records with names and ages which make sense.
Class Method Details
.modlr(model, number, &args) ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/modlr.rb', line 18 def self.modlr(model, number, &args) model.new.is_a?(ActiveRecord::Base) count = model.count if count >= number "No new records created: #{model} currently has #{count} records." end end |
Instance Method Details
#initialize ⇒ Object
modlr :class, number_of_records, => :type, :field => type
If I have a User class, with fields name (string), and age (int), then
`modlr :user, 100, {:name => :name, :age => :age}`
will create 100 user records with names and ages which make sense.
14 15 16 |
# File 'lib/modlr.rb', line 14 def initialize end |