我有一个“资产”模型的搜索页面,除了搜索“serial_no”字段特定的任何内容之外,一切都工作正常。
资产.rb
# == Schema Information
#
# Table name: assets
#
# id :integer not null, primary key
# asset_description :string(255)
# asset_type :string(255)
# status :string(255)
# serial_no :string(255)
# user_id :integer
# cost :decimal(, )
# barcode :string(255)
# comment :string(255)
# date_purchased :date
# created_at :datetime not null
# updated_at :datetime not null
#
class Asset < ActiveRecord::Base
attr_accessible :asset_description, :asset_type, :comment,
:date_purchased, :serial_no, :status, :user_id, :cost, :barcode
belongs_to :user
validates :user_id, presence: true
validates :asset_description, …Run Code Online (Sandbox Code Playgroud)