Sha256: 3b22a28f04b957a81ef75edcb5ae979a1b53c4327b1295af4b302e4f136d80eb
Contents?: true
Size: 1.06 KB
Versions: 19
Compression:
Stored size: 1.06 KB
Contents
class HoboModelGenerator < Rails::Generator::NamedBase def manifest record do |m| # Check for class naming collisions. m.class_collisions class_path, class_name, "#{class_name}Test" # Model, test, and fixture directories. m.directory File.join('app/models', class_path) m.directory File.join('test/unit', class_path) m.directory File.join('test/fixtures', class_path) m.directory File.join("app/viewhints") # Model class, unit test, and fixtures. m.template 'model.rb', File.join('app/models', class_path, "#{file_name}.rb") m.template 'hints.rb', File.join('app/viewhints', class_path, "#{file_name}_hints.rb") m.template 'unit_test.rb', File.join('test/unit', class_path, "#{file_name}_test.rb") m.template 'fixtures.yml', File.join('test/fixtures', class_path, "#{table_name}.yml") end end protected def banner "Usage: #{$0} #{spec.name} ModelName [field:type, field:type]" end def max_attribute_length attributes.*.name.*.length.max end end
Version data entries
19 entries across 19 versions & 1 rubygems