Class: Tableview::Generators::TableviewGenerator
- Inherits:
-
Rails::Generators::NamedBase
- Object
- Rails::Generators::NamedBase
- Tableview::Generators::TableviewGenerator
- Defined in:
- lib/generators/tableview/tableview_generator.rb
Instance Method Summary collapse
Instance Method Details
#create_partial ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/generators/tableview/tableview_generator.rb', line 8 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 |
#install_into_controller ⇒ Object
17 18 19 |
# File 'lib/generators/tableview/tableview_generator.rb', line 17 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 |