Skip to content

Commit

Permalink
Fixes #2715 by ensuring class names exist first.
Browse files Browse the repository at this point in the history
  • Loading branch information
parndt committed Jul 19, 2015
1 parent 0f568f0 commit 8f56bf4
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 12 deletions.
40 changes: 28 additions & 12 deletions pages/db/migrate/20100913234708_create_refinerycms_pages_schema.rb
Expand Up @@ -38,22 +38,38 @@ def up
add_index :refinery_pages, :parent_id
add_index :refinery_pages, :rgt

Refinery::PagePart.create_translation_table!({
:body => :text
})

Refinery::Page.create_translation_table!({
:title => :string,
:custom_slug => :string,
:menu_title => :string,
:slug => :string
})
begin
::Refinery::PagePart.create_translation_table!({
:body => :text
})
rescue NameError
warn "Refinery::PagePart was not defined!"
end

begin
::Refinery::Page.create_translation_table!({
:title => :string,
:custom_slug => :string,
:menu_title => :string,
:slug => :string
})
rescue NameError
warn "Refinery::Page was not defined!"
end
end

def down
drop_table :refinery_page_parts
drop_table :refinery_pages
Refinery::PagePart.drop_translation_table!
Refinery::Page.drop_translation_table!
begin
::Refinery::PagePart.drop_translation_table!
rescue NameError
warn "Refinery::PagePart was not defined!"
end
begin
::Refinery::Page.drop_translation_table! if defined?(::Refinery::Page)
rescue NameError
warn "Refinery::Page was not defined!"
end
end
end
Expand Up @@ -13,6 +13,8 @@ def down

private
def page_column_names
return [] unless defined?(::Refinery::Page)

Refinery::Page.column_names.map(&:to_s)
end
end

0 comments on commit 8f56bf4

Please sign in to comment.