| 1 |
class Wiki < ActiveRecord::Base |
| 2 |
|
| 3 |
def deep_clone |
| 4 |
Marshal::load(Marshal.dump(self)) |
| 5 |
end |
| 6 |
|
| 7 |
protected |
| 8 |
|
| 9 |
def self.find_by_search(phrase) |
| 10 |
|
| 11 |
end |
| 12 |
|
| 13 |
def self.find_by_id(wiki_id) |
| 14 |
find(:first, :conditions => ["status = '#{:published}' AND id = '#{wiki_id}'"]) |
| 15 |
end |
| 16 |
|
| 17 |
def self.find_by_slug(slug) |
| 18 |
|
| 19 |
find(:first, :conditions => ["slug = '#{slug}'"]) |
| 20 |
end |
| 21 |
|
| 22 |
def self.find_by_project(id) |
| 23 |
find(:all, :conditions => ["project_id = '#{id}'"], :order => "views DESC, created_at ASC") |
| 24 |
end |
| 25 |
|
| 26 |
|
| 27 |
end |