Sha256: 27b6a2eca633ff8a60eea0b362b01b8696788836a81c9d7492d7b0d23187245d
Contents?: true
Size: 1.04 KB
Versions: 13
Compression:
Stored size: 1.04 KB
Contents
class <%= migration_name %> < ActiveRecord::Migration def self.up create_table :<%= table_name %> do |t| <% attributes.each do |attribute| # turn image or resource into what it was supposed to be which is an integer reference to an image or resource. if attribute.type.to_s =~ /^(image|resource)$/ attribute.type = 'integer' attribute.name = "#{attribute.name}_id".gsub("_id_id", "_id") end -%> t.<%= attribute.type %> :<%= attribute.name %> <% end -%> t.integer :position t.timestamps end add_index :<%= table_name %>, :id load(Rails.root.join('db', 'seeds', '<%= class_name.pluralize.underscore.downcase %>.rb')) end def self.down UserPlugin.destroy_all({:name => "<%= class_name.pluralize.underscore.titleize %>"}) Page.find_all_by_link_url("/<%= plural_name %>").each do |page| page.link_url, page.menu_match = nil page.deletable = true page.destroy end Page.destroy_all({:link_url => "/<%= plural_name %>"}) drop_table :<%= table_name %> end end
Version data entries
13 entries across 13 versions & 1 rubygems