以下代码适用于 Rails-2 应用程序,但不适用于 Rails-3 升级:
在 user.rb 模型中:
has_many :auction_lots, :class_name => "Auction::Lot", :order => "position"
在 lot.rb 模型中:
class Auction::Lot < ActiveRecord::Base
include ActionController::UrlWriter
belongs_to :user
scope :unplanned, :conditions => "status < #{STATUS[:in_stock]}"
end
ActionView::Template::Error(未初始化的常量 User::AuctionLot):
150: <% unless current_user.auction_lots.unplanned.empty? %>
activerecord (3.2.13) lib/active_record/inheritance.rb:111:in `compute_type'
activerecord (3.2.13) lib/active_record/reflection.rb:172:in `klass'
activerecord (3.2.13) lib/active_record/associations/association.rb:117:in `klass'
activerecord (3.2.13) lib/active_record/associations/collection_proxy.rb:86:in `method_missing'
请任何人解释。rails-2和rails-3之间有什么问题