Sha256: 82bbca0fc344c1ca9057cf0ccde64693067daa99e38b8fa1f7cc1aac7638984b
Contents?: true
Size: 802 Bytes
Versions: 23
Compression:
Stored size: 802 Bytes
Contents
module HorsePower class ModelGenerator < Rails::Generators::Base source_root File.expand_path('../templates', __FILE__) argument :resource_name, :type => :string argument :api_version, :type => :string, :default => "1" argument :attributes, type: :array, default: [], banner: "field:type field:type" def sprint template "model.rb.erb", "app/models/#{HorsePower.get_singular(resource_name)}.rb" # We only need this to create the migration if api_version == "1" run "rails g model #{HorsePower.get_singular(resource_name)} #{attributes.join(" ")} --no-fixture --skip" run "rm -rf spec/factories/#{HorsePower.get_plural(resource_name)}.rb" run "rm -rf spec/models/#{HorsePower.get_singular(resource_name)}_spec.rb" end end private end end
Version data entries
23 entries across 23 versions & 1 rubygems