Wiki: titulos canonicos

This commit is contained in:
2009-09-07 07:49:16 -03:00
parent ca993b06de
commit b9924402eb
5 changed files with 38 additions and 11 deletions

View File

@@ -0,0 +1,12 @@
class Canonical< ActiveRecord::Migration
def self.up
add_column :wiki_pages, :canonical_title, :string
WikiPage.find(:all).each do |wiki|
wiki.update_attribute(:canonical_title, wiki.title.pretty_url)
end
end
def self.down
remove_column :wiki_pages, :canonical_title
end
end

View File

@@ -1,5 +1,5 @@
# This file is auto-generated from the current state of the database. Instead of editing this file,
# please use the migrations feature of ActiveRecord to incrementally modify your database, and
# please use the migrations feature of Active Record to incrementally modify your database, and
# then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your database schema. If you need
@@ -9,7 +9,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 36) do
ActiveRecord::Schema.define(:version => 20090907095812) do
create_table "attachments", :force => true do |t|
t.string "file_name", :null => false
@@ -102,8 +102,8 @@ ActiveRecord::Schema.define(:version => 36) do
t.datetime "updated_at"
end
add_index "sessions", ["updated_at"], :name => "index_sessions_on_updated_at"
add_index "sessions", ["session_id"], :name => "index_sessions_on_session_id"
add_index "sessions", ["updated_at"], :name => "index_sessions_on_updated_at"
create_table "users", :force => true do |t|
t.string "login", :null => false
@@ -137,16 +137,17 @@ ActiveRecord::Schema.define(:version => 36) do
end
create_table "wiki_pages", :force => true do |t|
t.integer "course_id", :null => false
t.integer "user_id", :null => false
t.integer "version", :null => false
t.string "description", :null => false
t.string "title", :null => false
t.text "content", :null => false
t.integer "course_id", :null => false
t.integer "user_id", :null => false
t.integer "version", :null => false
t.string "description", :null => false
t.string "title", :null => false
t.text "content", :null => false
t.datetime "created_at"
t.datetime "updated_at"
t.integer "position"
t.datetime "deleted_at"
t.string "canonical_title"
end
end