Class: Mizugumo::JsAssetsGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Includes:
Rails::Generators::ResourceHelpers
Defined in:
lib/generators/rails/mizugumo/js_assets_generator.rb

Instance Method Summary collapse

Instance Method Details

#write_javascriptObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/generators/rails/mizugumo/js_assets_generator.rb', line 9

def write_javascript 
  return unless Mizugumo::RAILS_31
  create_file(File.join('app/assets/javascripts', "#{plural_table_name}.js")) do "Ninja.orders(function(Ninja){        \n  Ninja.behavior({\n// Generated by the mizugumo scaffold\n// AJAX behavior for edit, new, and delete actions; applies to both forms and links\n'.new_\#{singular_table_name}': Ninja.submitsAsAjax,\n'.edit_\#{singular_table_name}': Ninja.submitsAsAjax,\n'.delete_\#{singular_table_name}': Ninja.submitsAsAjax\n  });\n});\n"
  end
end