Sha256: 60bed6379c683a9163591abb0907f11d713fbe11478480cfd2e79c52add974d5
Contents?: true
Size: 521 Bytes
Versions: 5
Compression:
Stored size: 521 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 ((@modules.presence || ['Admin']) << @model_name.pluralize).join('::') end def attributes @model_name.constantize.columns.map(&:name) end end
Version data entries
5 entries across 5 versions & 1 rubygems