Sha256: 029ffc3bea8a630d918093d1f2794b4691f18ebcf02d76f645a93a45257dd88b
Contents?: true
Size: 1.05 KB
Versions: 3
Compression:
Stored size: 1.05 KB
Contents
require 'rails' require 'rails/generators/active_record' module Coalla module Cms module Image class InstallGenerator < ActiveRecord::Generators::Base argument :name, type: :string, default: "" source_root File.expand_path("../templates", __FILE__) class_option :prefixed, type: :boolean, default: false def setup_fields @properties = { 'file_name' => 'text', 'content_type' => 'text', 'size' => 'integer', 'description' => 'text', 'width' => 'integer', 'height' => 'integer', 'watermarked' => 'boolean', 'source' => 'text' } @prefixed = options.prefixed? end def copy_files migration_template "migration.rb.erb", "db/migrate/create_#{name.pluralize.underscore}.rb" template "model.rb.erb", "app/models/#{name.underscore}.rb" template "uploader.rb.erb", "app/uploaders/#{name.underscore}_uploader.rb" end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems