Class: Alchemy::Generators::IngredientGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/alchemy/ingredient/ingredient_generator.rb

Instance Method Summary collapse

Instance Method Details

#copy_templatesObject



20
21
22
23
24
25
# File 'lib/generators/alchemy/ingredient/ingredient_generator.rb', line 20

def copy_templates
  @ingredient_editor_local = "#{file_name}_editor"
  @ingredient_view_local = "#{file_name}_view"
  template "view.html.erb", "#{@ingredients_view_path}/_#{file_name}_view.html.erb"
  template "editor.html.erb", "#{@ingredients_view_path}/_#{file_name}_editor.html.erb"
end

#create_modelObject



16
17
18
# File 'lib/generators/alchemy/ingredient/ingredient_generator.rb', line 16

def create_model
  template "model.rb.tt", "app/models/alchemy/ingredients/#{file_name}.rb"
end

#initObject



11
12
13
14
# File 'lib/generators/alchemy/ingredient/ingredient_generator.rb', line 11

def init
  @class_name = class_name.classify
  @ingredients_view_path = "app/views/alchemy/ingredients"
end

#show_todoObject



27
28
29
# File 'lib/generators/alchemy/ingredient/ingredient_generator.rb', line 27

def show_todo
  say "\nPlease check the generated files and alter them to fit your needs."
end