Class: Cullender::Generators::CullenderGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Includes:
OrmHelpers, Rails::Generators::Migration
Defined in:
lib/generators/cullender/cullender_generator.rb

Instance Method Summary collapse

Methods included from OrmHelpers

#migration_exists?, #migration_path, #model_contents, #model_exists?, #model_path

Instance Method Details

#add_cullender_routesObject



17
18
19
20
21
22
# File 'lib/generators/cullender/cullender_generator.rb', line 17

def add_cullender_routes
	cullender_route  = "cullender_for :#{plural_name}"
	cullender_route << %Q(, :class_name => "#{class_name}") if class_name.include?("::")
	cullender_route << %Q(, :skip => :all) unless options.routes?
	route cullender_route
end

#copy_cullender_rules_migrationObject



25
26
27
# File 'lib/generators/cullender/cullender_generator.rb', line 25

def copy_cullender_rules_migration
	migration_template "cullender_migration.rb", "db/migrate/create_cullender_tables"
end

#migration_dataObject



56
57
58
59
60
61
62
# File 'lib/generators/cullender/cullender_generator.rb', line 56

def migration_data
<<RUBY
		t.string :name
		t.boolean :enabled
		t.text :triggers				
RUBY
end