Sha256: 4c0885e9e1a2827957e38450867dbe17ca4a7e40f9ea085bfa21677a84c6a82c
Contents?: true
Size: 786 Bytes
Versions: 1
Compression:
Stored size: 786 Bytes
Contents
require "redmine/generators/plugin_name_attribute" Rails::Generators.lookup %w(rails:model) module Redmine module Generators class ProjectModuleGenerator < Rails::Generators::ModelGenerator include PluginNameAttribute remove_hook_for :orm def add_project_module pm = " project_module :#{plural_table_name} do\n" pm << " permission :view_#{plural_table_name}, #{plural_table_name}: [:index, :show]\n" pm << " permission :manage_#{plural_table_name}, #{plural_table_name}: [:new, :create, :edit, :update, :destroy]\n" pm << " end\n" sentinel = /Redmine::Plugin\.register\s+:\w+\s+do\s?\n/ in_root do inject_into_file "init.rb", pm, after: sentinel end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
redmine-generators-0.0.1 | lib/redmine/generators/project_module_generator.rb |