The following is my show action: 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
The error its returning:
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/searchl开发者_C百科ogic/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'
I have been messing with this for awhile now and its not resolving...
I am using rvm to handle my versioning
gem -v = 1.5.3 Rails -v = 3.1.1 Ruby -v = 1.8.7
I wonder if its the rails version issue... any ideas?
Turned out to be a couple things: Rails version, needed to specify 2.3.x and yes the conditions where inside a hash... had to make it an array
精彩评论