This commit is contained in:
albert
2011-05-26 19:10:08 -04:00
parent ca68b2def1
commit 969185ad24
31 changed files with 629 additions and 575 deletions

View File

@@ -14,7 +14,7 @@ class Artist < ActiveRecord::Base
attr_accessible :name, :url_string, :other_names, :group_name, :wiki_page_attributes, :notes
scope :url_match, lambda {|string| where(["id in (?)", Artist.find_all_by_url(string).map(&:id)])}
scope :other_names_match, lambda {|string| where(["other_names_index @@ to_tsquery('danbooru', ?)", Artist.normalize_name(string)])}
search_method :url_match, :other_names_match
search_methods :url_match, :other_names_match
module UrlMethods
module ClassMethods

View File

@@ -8,7 +8,7 @@ class ForumPost < ActiveRecord::Base
validates_presence_of :body, :creator_id
validate :validate_topic_is_unlocked
scope :body_matches, lambda {|body| where(["text_index @@ plainto_tsquery(?)", body])}
search_method :body_matches
search_methods :body_matches
def self.new_reply(params)
if params[:topic_id]