Skip to content

Instantly share code, notes, and snippets.

@dcvezzani
Created June 4, 2013 14:02
Show Gist options
  • Save dcvezzani/5706165 to your computer and use it in GitHub Desktop.
Save dcvezzani/5706165 to your computer and use it in GitHub Desktop.
When generating a custom content block type in BrowserCms, the migration generated uses 'def change'. A down migration doesn't appear to work and it is required to go back to the self.up and self.down notation.
class CreateBcmsMy401kWidgets < ActiveRecord::Migration
def self.up
Cms::ContentType.create!(:name => "BcmsMy401k::Widget", :group_name => "BcmsMy401k::Widget")
create_content_table :bcms_my401k_widgets, :prefix=>false do |t|
t.integer :user_id
t.string :name
t.text :description
t.timestamps
end
end
def self.down
drop_table :bcms_my401k_widgets
ActiveRecord::Base.connection.execute "delete from content_types where name = 'BcmsMy401k::Widget'"
ActiveRecord::Base.connection.execute "delete from content_type_groups where name = 'BcmsMy401k::Widget'"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment