# Class Wiki < ActiveRecord::Base

- app/models/wiki.rb

## 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

Methods

R
  - regenerate_from
S
  - search,
  - set_slug
T
  - to_param

Class Public methods
search(query) Link

Source: show

    # File app/models/wiki.rb, line 33
    def search(query)
      where("title like :query OR content like :query", query: "%#{query}%")
    end

Class Protected methods
regenerate_from(wiki) Link

Source: show

    # File app/models/wiki.rb, line 40
    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

Instance Public methods
to_param() Link

Source: show

    # File app/models/wiki.rb, line 28
    def to_param
      slug
    end

Instance Protected methods
set_slug() Link

Source: show

    # File app/models/wiki.rb, line 50
    def set_slug
      self.slug = self.title.parameterize
    end