从红宝石中的下拉选项中搜索并显示

时间:2015-09-10 05:57:07

标签: ruby-on-rails ruby model

如何从ruby中的下拉选项中搜索某些内容并显示?

class Detail < ActiveRecord::Base
        validates :name, :email, :designation,  presence: true
        validates :email, uniqueness: true

        def self.search(search)
            if search
        find(:all, :conditions => ['name LIKE '%?%'", search[:name])
        else 
            find(:all)
    end
    end

0 个答案:

没有答案