Class: Resourceable::Generators::ResourceGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Defined in:
lib/generators/resourceable/resource_generator.rb

Instance Method Summary collapse

Instance Method Details

#controllerObject



12
13
14
15
16
17
18
19
20
# File 'lib/generators/resourceable/resource_generator.rb', line 12

def controller 
  generate 'controller', name.titleize.pluralize
  
  puts "app/controllers/#{name.downcase.pluralize}_coontroller.rb"
  puts "#{name.titleize.pluralize}Controller"

  inject_into_class controller_path, controller_name, 
    "\tcrud permitted: #{attribute_keys}\n"    
end

#modelObject



8
9
10
# File 'lib/generators/resourceable/resource_generator.rb', line 8

def model
  generate 'model', "#{name} #{attributes_cli_options}"
end