以下是我的节目动作: def show
@category = Category.find_by_url_name(params[:id])
@brands = @category.brands
@categories = Category.find(:all)
@meta_title = "#{@category.name}"
respond_to do |format|
format.html
@brand = @brands.first
@search = Product.search.order(params[:order] || 'descend_by_date')
@products = @search.paginate(:conditions => { :category_id => @category, :brand_id => @brand }, :page => params[:page])
render :template => 'brands/show'
format.xml { render :xml => @category }
end
end
它返回的错误:
NoMethodError (You have a nil object when you didn't expect it!
The error occurred while evaluating nil.to_sym):
searchlogic (2.5.8) lib/searchlogic/active_record/named_scope_tools.rb:16:in `named_scope_options'
searchlogic (2.5.8) lib/searchlogic/named_scopes/alias_scope.rb:54:in `named_scope_options'
searchlogic (2.5.8) lib/searchlogic/named_scopes/or_conditions.rb:14:in `named_scope_options'
searchlogic (2.5.8) lib/searchlogic/search/scopes.rb:15:in `scope_options'
searchlogic (2.5.8) lib/searchlogic/search/method_missing.rb:80:in `cast_type'
searchlogic (2.5.8) lib/searchlogic/search/method_missing.rb:22:in `method_missing'
searchlogic (2.5.8) lib/searchlogic/search/method_missing.rb:36:in `send'
searchlogic (2.5.8) lib/searchlogic/search/method_missing.rb:36:in `method_missing'
app/controllers/categories_controller.rb:28:in `show'
app/controllers/categories_controller.rb:25:in `show'
我现在已经搞砸了一段时间而且没有解决......
我正在使用rvm来处理我的版本控制
gem -v = 1.5.3 Rails -v = 3.1.1 Ruby -v = 1.8.7
我想知道它的导轨版本问题......有什么想法吗?
答案 0 :(得分:0)
原来是一些东西:Rails版本,需要指定2.3.x,是的,哈希内部的条件......必须使它成为一个数组