Sha256: af5216716a562420c5ac57396ebdb6eac4953a6899d941843e10e58413f9ebd6
Contents?: true
Size: 804 Bytes
Versions: 5
Compression:
Stored size: 804 Bytes
Contents
require 'rails' module Tableview module Generators class TableviewGenerator < ::Rails::Generators::NamedBase namespace "tableview" desc "Generates a partial and some controller code to use tableview." def create_partial cols = file_name.camelize.constantize.column_names template = "=> @#{file_name.tableize}\n\n" cols.each do |col| template << "+ :#{col}\n" end create_file "app/views/#{file_name.tableize}/_table.tv", template end def install_into_controller inject_into_class "app/controllers/#{file_name.tableize}_controller.rb", file_name.camelize.pluralize + "Controller", " self.responder = ApplicationResponder\n respond_to :html, :json, :csv, :xls, :ascii" end end end end
Version data entries
5 entries across 5 versions & 1 rubygems