Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Use Refinery namespace in migration and seed file.

  • Loading branch information...
commit 536583bb5c42c70f487e43b5e72a848e8dc7eab9 1 parent 4f3a2ff
Uģis Ozols ugisozols authored
12 db/migrate/01_create_search_page.rb
View
@@ -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
14 db/seeds/refinerycms_search.rb
View
@@ -1,5 +1,5 @@
-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)
@@ -7,17 +7,17 @@
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
Please sign in to comment.
Something went wrong with that request. Please try again.