Sha256: 4fcc5c1b5b8c327cd4d1be3066be4816113abcdbe7f3442736dc43d6fe1f0549
Contents?: true
Size: 526 Bytes
Versions: 3
Compression:
Stored size: 526 Bytes
Contents
class Puffer::ControllerGenerator < Rails::Generators::NamedBase source_root File.expand_path('../templates', __FILE__) def generate_controller @modules = name.classify.split('::') @model_name = @modules.delete_at(-1) template 'controller.rb', "app/controllers/#{controller_name.underscore}_controller.rb" end private def controller_name [(swallow_nil{@modules.first} || 'Admin'), @model_name.pluralize].join('::') end def attributes @model_name.constantize.columns.map(&:name) end end
Version data entries
3 entries across 3 versions & 1 rubygems