Skip to content
Browse files

Added cached_slug column instead which provides greater performance a…

…nd works with marketable urls.
  • Loading branch information...
1 parent c12c2e5 commit 207d17ad5f45d55cc9e7e4645b07febb2d219d31 @parndt parndt committed
View
12 db/migrate/20100913234704_add_cached_slug_to_pages.rb
@@ -0,0 +1,12 @@
+class AddCachedSlugToPages < ActiveRecord::Migration
+ def self.up
+ add_column :pages, :cached_slug, :string
+ Page.all.each do |p|
+ p.save!
+ end
+ end
+
+ def self.down
+ remove_column :pages, :cached_slug
+ end
+end
View
3 db/schema.rb
@@ -10,7 +10,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20100831122919) do
+ActiveRecord::Schema.define(:version => 20100913234704) do
create_table "images", :force => true do |t|
t.string "image_mime_type"
@@ -77,6 +77,7 @@
t.integer "lft"
t.integer "rgt"
t.integer "depth"
+ t.string "cached_slug"
end
add_index "pages", ["depth"], :name => "index_pages_on_depth"
View
1 refinerycms.gemspec
@@ -88,6 +88,7 @@ Gem::Specification.new do |s|
'db/migrate/20100729221735_remove_page_translations_if_present.rb',
'db/migrate/20100826232810_move_inquiry_settings_to_refinery_settings.rb',
'db/migrate/20100831122919_move_page_to_nested_set.rb',
+ 'db/migrate/20100913234704_add_cached_slug_to_pages.rb',
'db/schema.rb',
'db/seeds',
'db/seeds.rb',
View
2 vendor/refinerycms/core/lib/refinery/application_controller.rb
@@ -79,7 +79,7 @@ def login?
# get all the pages to be displayed in the site menu.
def find_pages_for_menu
- @menu_pages = Page.order('lft ASC').includes(:slugs, :slug, :parts)
+ @menu_pages = Page.order('lft ASC').includes(:parts)
end
# use a different model for the meta information.

0 comments on commit 207d17a

Please sign in to comment.
Something went wrong with that request. Please try again.