<分区>
我已经建立我的工作委员会大约 10 个月了。我为用户提供了搜索和申请的能力,但我认为有必要为他们提供匹配结果。我知道有很多方法可以进行匹配,但最有效的方法是什么。是继续把匹配算法写在用户模型里,还是做成模块,还是做成插件?目前我已经在模型中启动了它,但它似乎会变得非常困惑。
class User < ActiveRecord::Base
attr_accessible :name, :provider, :uid, :bio, :gender, :location, :interests, :education, :jobs, :state, :city, :resume, :available, :website, :video_cover, :date_of_birth,
:language, :skills
class Job < ActiveRecord::Base
attr_accessible :title, :company, :company_description, :industry, :requisition_number, :city, :state, :zipcode, :posted_ate, :experience, :job_type, :longitude, :latitude, :recruiter_id, :apply_link, :contact_name, :contact_email, :job_id
def self.search(search)
if search
find(:all, :conditions => ['title LIKE ?', "%#{search}%"])
else
find(:all)
end
end
我应该扩展搜索方法并在模型用户和工作模型中创建匹配算法还是将其移动到模块中?