Class: SeedHelper
- Inherits:
-
Object
- Object
- SeedHelper
- Extended by:
- OutputFormatter, RakeHelper
- Defined in:
- lib/seed_helper.rb,
lib/seed_helper/version.rb
Defined Under Namespace
Modules: OutputFormatter, RakeHelper
Constant Summary collapse
- VERSION =
"1.1.0"
Instance Method Summary collapse
Methods included from OutputFormatter
error, message, output, resource_already_exists, special_message, success
Methods included from RakeHelper
Instance Method Details
#create_resource(resource_class, attributes) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/seed_helper.rb', line 10 def create_resource(resource_class, attributes) if resource = find_resource(resource_class, attributes) resource_already_exists(resource) else resource = resource_class.new(attributes) if resource.save = "#{resource} successfully created" success() else = "#{resource} failed to create. Errors: #{resource.errors.full_messages}" error() end end return resource end |