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



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

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



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

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

#initObject



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

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

#show_todoObject



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

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