Sha256: 79349ac3f057d510e3673b18b83564fa249bfb74625ea1a0cf8d6616ff89aee2

Contents?: true

Size: 795 Bytes

Versions: 6

Compression:

Stored size: 795 Bytes

Contents

require 'rails/generators/resource_helpers'
require 'generators/ixtlan/scaffold/scaffold_generator.rb'
module Ixtlan
  class PermissionsScaffoldGenerator < 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
      "permission"
    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.keys.reverse.each do |action|
        route %{get "#{file_name}/#{action}"}
      end
    end

    def aliases
      {}
    end

    def actions
      {'index' => [:*], 'show' => []}
    end
    
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ixtlan-guard-0.7.0 lib/generators/ixtlan/permissions_scaffold/permissions_scaffold_generator.rb
ixtlan-guard-0.6.1 lib/generators/ixtlan/permissions_scaffold/permissions_scaffold_generator.rb
ixtlan-guard-0.6.0 lib/generators/ixtlan/permissions_scaffold/permissions_scaffold_generator.rb
ixtlan-guard-0.5.0 lib/generators/ixtlan/permissions_scaffold/permissions_scaffold_generator.rb
ixtlan-guard-0.4.1 lib/generators/ixtlan/permissions_scaffold/permissions_scaffold_generator.rb
ixtlan-guard-0.4.0 lib/generators/ixtlan/permissions_scaffold/permissions_scaffold_generator.rb