Sha256: e361bff9f39d7cb8c5da62693cbab2b08fb625b82dba7b2c72ddd670232dcebf
Contents?: true
Size: 994 Bytes
Versions: 6
Compression:
Stored size: 994 Bytes
Contents
require 'rails/generators/resource_helpers' require 'generators/ixtlan/scaffold/scaffold_generator.rb' ActiveSupport::Inflector.inflections do |inflect| inflect.irregular 'maintenance', 'maintenance' end module Ixtlan class MaintenanceScaffoldGenerator < ScaffoldGenerator source_root File.expand_path('../../templates', __FILE__) arguments.clear # clear name argument from NamedBase def name # set alias so NamedBase uses the model as its name "maintenance" end def create_controller_files template 'simple_controller.rb', File.join('app', 'controllers', class_path, "#{plural_file_name}_controller.rb") end def add_routes actions.reverse.each do |action| if action == 'index' route %{get "#{file_name}/#{action}"} else route %{put "#{file_name}/#{action}"} end end end def aliases {} end def actions ['index', 'block', 'resume'] end end end
Version data entries
6 entries across 6 versions & 1 rubygems