Skip to main content

NameError (undefined local variable or method `fetch_records' for ....

Databases • Asked by Victor Nizeyimana

Hi,

I'm getting this wierd error.

NameError (undefined local variable or method `fetch_records' for #<CommentsDatatable:0x00007f7fae91f8b8>):
app/controllers/admin_controller.rb:69:in `block (2 levels) in comments'
app/controllers/admin_controller.rb:67:in `comments'

Code:

  def comments
    respond_to do |format|
      format.html
      format.json { render json: CommentsDatatable.new(view_context) }
    end
  end

Hey Victor,

Are you sure fetch_records isn't a method you're supposed to define in your class? From the examples for the datatables gem, it looks like you typically write that method yourself in the class.


Can you post your CommentsDatabale class for us as well?


Hey Chris,

I found the solution. https://github.com/jbox-web/ajax-datatables-rails/blob/master/doc/migrate.md
I used the old methods...

Thanks for your help! and support!


Login or Create An Account to join the conversation.

Subscribe to the newsletter

Join 22,346+ developers who get early access to new screencasts, articles, guides, updates, and more.

    By clicking this button, you agree to the GoRails Terms of Service and Privacy Policy.

    More of a social being? We're also on Twitter and YouTube.