Permalink
Browse files

Use Refinery namespace in migration and seed file.

  • Loading branch information...
1 parent 4f3a2ff commit 536583bb5c42c70f487e43b5e72a848e8dc7eab9 @ugisozols ugisozols committed Sep 7, 2011
Showing with 13 additions and 13 deletions.
  1. +6 −6 db/migrate/01_create_search_page.rb
  2. +7 −7 db/seeds/refinerycms_search.rb
@@ -1,16 +1,16 @@
class CreateSearchPage < ActiveRecord::Migration
- def self.up
+ def up
load(Rails.root.join('db', 'seeds', 'refinerycms_search.rb'))
end
- def self.down
- if defined?(UserPlugin)
- UserPlugin.destroy_all({:name => "refinerycms_search"})
+ def down
+ if defined?(Refinery::UserPlugin)
+ Refinery::UserPlugin.destroy_all({:name => "refinerycms_search"})
end
- if defined?(Page)
- Page.delete_all({:link_url => "/search"})
+ if defined?(Refinery::Page)
+ Refinery::Page.delete_all({:link_url => "/search"})
end
end
@@ -1,23 +1,23 @@
-if defined?(::User)
- User.all.each do |user|
+if defined?(::Refinery::User)
+ Refinery::User.all.each do |user|
if user.plugins.where(:name => 'refinerycms_search').blank?
user.plugins.create(:name => 'refinerycms_search',
:position => (user.plugins.maximum(:position) || -1) +1)
end
end
end
-if defined?(::Page)
- unless Page.where(:menu_match => "^/search.*$").any?
- page = Page.create(
+if defined?(::Refinery::Page)
+ unless Refinery::Page.where(:menu_match => "^/search.*$").any?
+ page = Refinery::Page.create(
:title => "Search Results",
:link_url => "/search",
:deletable => false,
- :position => ((Page.maximum(:position, :conditions => {:parent_id => nil}) || -1)+1),
+ :position => ((Refinery::Page.maximum(:position, :conditions => {:parent_id => nil}) || -1)+1),
:menu_match => "^/search.*$"
)
- Page.default_parts.each do |default_page_part|
+ Refinery::Page.default_parts.each do |default_page_part|
page.parts.create(:title => default_page_part, :body => nil)
end
end

0 comments on commit 536583b

Please sign in to comment.