Sha256: f7898fa2de47c663561f8e19adbba256c2414d2547b82570d75f40cdd3d34852
Contents?: true
Size: 865 Bytes
Versions: 5
Compression:
Stored size: 865 Bytes
Contents
class ModelGenerator < Rails::Generator::NamedBase #:nodoc: def manifest record do |m| self.class.check_collisions(m, class_path, class_name) self.class.generate(m, class_path, file_name) end end def self.check_collisions(m, class_path, class_name) # Check for class naming collisions. m.class_collisions class_path, class_name, "#{class_name}Test" end def self.generate(m, class_path, file_name) # Model, test, and fixture directories. m.directory File.join('app/models', class_path) m.directory File.join('test/unit', class_path) # Model class, unit test, and fixtures. m.template '../../model/templates/model.rb', File.join('app/models', class_path, "#{file_name}.rb") m.template '../../model/templates/unit_test.rb', File.join('test/unit', class_path, "#{file_name}_test.rb") end end
Version data entries
5 entries across 5 versions & 2 rubygems