TypeError (Cannot visit Category):

Hey all,

this order_by method right here is throwing an exception:


The exception is "TypeError (Cannot visit Category):"

I think it's returning this:


I have no clue why. It's supposed to be returning a string like
'controller asc'.

This is the lead up to the error:

def find_options
    opts = {:page => @will_paginate_page, :per_page =>
@will_paginate_per_page, :order => @will_paginate_order}

def additional_options

def extract_pagination
    @will_paginate_page = params[:page] || 1
   @will_paginate_per_page = params[:per_page] || 20

  def extract_order
    if params[:order].present?
      @order_field = params[:order]
     @will_paginate_order = @resource_model.order_by(@order_field)

#my category model inherits from restfulmodel.rb:

def self.order_by(field)
    field = field.to_s
    if field.blank?
      return default_order ? order_by(default_order) : scoped(nil) #if
returned value of default_order call exists, self-invoke order_by
     scope = field.starts_with?('-') ? 'descend_by_' + field.from(1) :
'ascend_by_' + field

#then my category model has this:
  def self.default_order

  scope :ascend_by_controller, :order => 'controller asc'

Something is flawed with that order_by method. It's not sending
ascend_by_controller to the category model and then returning the value
of the scope :ascend_by_controller. Am I missing something here?

@will_paginate_order should hold a string like 'controller asc'

Thanks for response.