Sha256: afb2a276a61141c8f46eee0e2817cd112b49d0aabe22de6da7a1953b765ffb82
Contents?: true
Size: 527 Bytes
Versions: 10
Compression:
Stored size: 527 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
10 entries across 10 versions & 1 rubygems