diff --git a/app/contexts/search_context.rb b/app/contexts/search_context.rb index 9becb8d674f..de6542e82f4 100644 --- a/app/contexts/search_context.rb +++ b/app/contexts/search_context.rb @@ -13,7 +13,7 @@ class SearchContext result[:projects] = Project.where(id: project_ids).search(query).limit(10) result[:merge_requests] = MergeRequest.where(project_id: project_ids).search(query).limit(10) result[:issues] = Issue.where(project_id: project_ids).search(query).limit(10) - result[:wiki_pages] = Wiki.where(project_id: project_ids).search(query).limit(10) + result[:wiki_pages] = [] result end diff --git a/app/models/project.rb b/app/models/project.rb index a3357373d02..cad8f1666d3 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -53,7 +53,6 @@ class Project < ActiveRecord::Base has_many :snippets, dependent: :destroy has_many :deploy_keys, dependent: :destroy, class_name: "Key", foreign_key: "project_id" has_many :hooks, dependent: :destroy, class_name: "ProjectHook" - has_many :wikis, dependent: :destroy has_many :protected_branches, dependent: :destroy has_many :user_team_project_relationships, dependent: :destroy diff --git a/app/models/wiki.rb b/app/models/wiki.rb deleted file mode 100644 index 7f488ca7625..00000000000 --- a/app/models/wiki.rb +++ /dev/null @@ -1,55 +0,0 @@ -# == Schema Information -# -# Table name: wikis -# -# id :integer not null, primary key -# title :string(255) -# content :text -# project_id :integer -# created_at :datetime not null -# updated_at :datetime not null -# slug :string(255) -# user_id :integer -# - -class Wiki < ActiveRecord::Base - attr_accessible :title, :content, :slug - - belongs_to :project - belongs_to :user - has_many :notes, as: :noteable, dependent: :destroy - - validates :content, presence: true - validates :user, presence: true - validates :title, presence: true, length: 1..250 - - before_update :set_slug - - scope :ordered, order("created_at DESC") - - def to_param - slug - end - - class << self - def search(query) - where("title like :query OR content like :query", query: "%#{query}%") - end - end - - protected - - def self.regenerate_from wiki - regenerated_field = [:slug, :content, :title] - - new_wiki = Wiki.new - regenerated_field.each do |field| - new_wiki.send("#{field}=", wiki.send(field)) - end - new_wiki - end - - def set_slug - self.slug = self.title.parameterize - end -end diff --git a/db/migrate/20130410175022_remove_wiki_table.rb b/db/migrate/20130410175022_remove_wiki_table.rb new file mode 100644 index 00000000000..9077aa2473c --- /dev/null +++ b/db/migrate/20130410175022_remove_wiki_table.rb @@ -0,0 +1,9 @@ +class RemoveWikiTable < ActiveRecord::Migration + def up + drop_table :wikis + end + + def down + raise ActiveRecord::IrreversibleMigration + end +end diff --git a/db/schema.rb b/db/schema.rb index b11311e552a..33407e600a4 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20130404164628) do +ActiveRecord::Schema.define(:version => 20130410175022) do create_table "events", :force => true do |t| t.string "target_type" @@ -300,17 +300,4 @@ ActiveRecord::Schema.define(:version => 20130404164628) do t.integer "service_id" end - create_table "wikis", :force => true do |t| - t.string "title" - t.text "content" - t.integer "project_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "slug" - t.integer "user_id" - end - - add_index "wikis", ["project_id"], :name => "index_wikis_on_project_id" - add_index "wikis", ["slug"], :name => "index_wikis_on_slug" - end diff --git a/spec/models/wiki_spec.rb b/spec/models/wiki_spec.rb deleted file mode 100644 index 9750b81d303..00000000000 --- a/spec/models/wiki_spec.rb +++ /dev/null @@ -1,35 +0,0 @@ -# == Schema Information -# -# Table name: wikis -# -# id :integer not null, primary key -# title :string(255) -# content :text -# project_id :integer -# created_at :datetime not null -# updated_at :datetime not null -# slug :string(255) -# user_id :integer -# - -require 'spec_helper' - -describe Wiki do - describe "Associations" do - it { should belong_to(:project) } - it { should belong_to(:user) } - it { should have_many(:notes).dependent(:destroy) } - end - - describe "Mass assignment" do - it { should_not allow_mass_assignment_of(:project_id) } - it { should_not allow_mass_assignment_of(:user_id) } - end - - describe "Validation" do - it { should validate_presence_of(:title) } - it { should ensure_length_of(:title).is_within(1..250) } - it { should validate_presence_of(:content) } - it { should validate_presence_of(:user) } - end -end