class ActiveGroonga::Generators::ModelGenerator
Public Class Methods
new(args, *options)
click to toggle source
Calls superclass method
# File lib/rails/generators/active_groonga/model/model_generator.rb, line 33 def initialize(args, *options) super @key = nil @table_type = nil @key_normalize = false @default_tokenizer = nil parse_columns! end
Public Instance Methods
create_migration_file()
click to toggle source
# File lib/rails/generators/active_groonga/model/model_generator.rb, line 42 def create_migration_file return unless options[:migration] && options[:parent].nil? migration_template("migration.rb", "db/groonga/migrate/create_#{table_name}.rb") end
create_model_file()
click to toggle source
# File lib/rails/generators/active_groonga/model/model_generator.rb, line 48 def create_model_file template('model.rb', File.join("app/models", class_path, "#{file_name}.rb")) end
create_module_file()
click to toggle source
# File lib/rails/generators/active_groonga/model/model_generator.rb, line 53 def create_module_file return if class_path.empty? if behavior == :invoke template('module.rb', "app/models/#{class_path.join('/')}.rb") end end
create_table_code()
click to toggle source
# File lib/rails/generators/active_groonga/model/model_generator.rb, line 60 def create_table_code code = "create_table(:#{table_name}" options = [] options << ":type => :#{@table_type}" if @table_type options << ":key_type => \"#{@key}\"" if @key options << ":key_normalize => #{@key_normalize}" if @key_normalize options << ":default_tokenizer => \"#{@tokenizer}\"" if @tokenizer code << ", #{options.join(', ')}" unless options.empty? code << ")" code end
remove_table_code()
click to toggle source
# File lib/rails/generators/active_groonga/model/model_generator.rb, line 72 def remove_table_code "remove_table(:#{table_name})" end
Protected Instance Methods
parent_class_name()
click to toggle source
# File lib/rails/generators/active_groonga/model/model_generator.rb, line 79 def parent_class_name options[:parent] || "ActiveGroonga::Base" end