Sha256: 05ebd0559afcb56208bfb4ffed51f38a62879c46e5a5a963faf589eb19221792
Contents?: true
Size: 895 Bytes
Versions: 9
Compression:
Stored size: 895 Bytes
Contents
class NewsGenerator < Rails::Generator::NamedBase def initialize(*runtime_args) # set first argument to the table's name so that the user doesn't have to pass it in. runtime_args[0] = ["news_items"] super(*runtime_args) end def banner "Usage: script/generate news" end def manifest record do |m| m.migration_template 'migration.rb', 'db/migrate', :migration_file_name => "create_structure_for_news", :assigns => { :migration_name => "CreateStructureForNews", :table_name => "news_items", :attributes => [ Rails::Generator::GeneratedAttribute.new("title", "string"), Rails::Generator::GeneratedAttribute.new("body", "text"), Rails::Generator::GeneratedAttribute.new("publish_date", "datetime") ] } end end end if defined?(Rails::Generator::NamedBase)
Version data entries
9 entries across 9 versions & 2 rubygems