diff --git a/app/controllers/wiki_pages_controller.rb b/app/controllers/wiki_pages_controller.rb index 63775b070..a98bf9962 100644 --- a/app/controllers/wiki_pages_controller.rb +++ b/app/controllers/wiki_pages_controller.rb @@ -16,7 +16,7 @@ class WikiPagesController < ApplicationController end def index - @wiki_pages = WikiPage.search(params[:search]).order("id desc").paginate(params[:page], :search_count => params[:search]) + @wiki_pages = WikiPage.search(params[:search]).order("updated_at desc").paginate(params[:page], :search_count => params[:search]) respond_with(@wiki_pages) do |format| format.html do if @wiki_pages.count == 1 diff --git a/db/migrate/20130318012517_add_updated_at_index_to_wiki_pages.rb b/db/migrate/20130318012517_add_updated_at_index_to_wiki_pages.rb new file mode 100644 index 000000000..1ca3a98b8 --- /dev/null +++ b/db/migrate/20130318012517_add_updated_at_index_to_wiki_pages.rb @@ -0,0 +1,5 @@ +class AddUpdatedAtIndexToWikiPages < ActiveRecord::Migration + def change + add_index :wiki_pages, :updated_at + end +end diff --git a/db/structure.sql b/db/structure.sql index bdf91e29f..3ec292fda 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -6045,6 +6045,13 @@ CREATE UNIQUE INDEX index_wiki_pages_on_title ON wiki_pages USING btree (title); CREATE INDEX index_wiki_pages_on_title_pattern ON wiki_pages USING btree (title text_pattern_ops); +-- +-- Name: index_wiki_pages_on_updated_at; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_wiki_pages_on_updated_at ON wiki_pages USING btree (updated_at); + + -- -- Name: unique_schema_migrations; Type: INDEX; Schema: public; Owner: -; Tablespace: -- @@ -6244,4 +6251,6 @@ INSERT INTO schema_migrations (version) VALUES ('20130307225324'); INSERT INTO schema_migrations (version) VALUES ('20130308204213'); -INSERT INTO schema_migrations (version) VALUES ('20130318002652'); \ No newline at end of file +INSERT INTO schema_migrations (version) VALUES ('20130318002652'); + +INSERT INTO schema_migrations (version) VALUES ('20130318012517'); \ No newline at end of file