Sha256: 522bcd6f11eebe5616c84dc2062cf7e48a503497b094b42b0dd349611f5c35cc
Contents?: true
Size: 702 Bytes
Versions: 15
Compression:
Stored size: 702 Bytes
Contents
module MyAdmin module Generators class ModelGenerator < Rails::Generators::Base source_root File.expand_path('../templates', __FILE__) argument :model, :type => :string, :description => "Model Name" def generate_install directory = File.expand_path('../templates', __FILE__) template "controllers/controller.rb", "app/controllers/my_admin/#{controller_name.downcase}_controller.rb" File.open("#{Rails.root}/config/initializers/my_admin.rb", "a+"){|f| f << "\nMyAdmin::Application.add([#{model.camelize}])" } end def controller_name model.camelize.pluralize end end end end
Version data entries
15 entries across 15 versions & 1 rubygems