All threads / NameError (undefined local variable or method `fetch_records' for ....
Ask A Question


You’re not receiving notifications from this thread.

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

Victor Nizeyimana asked in Databases


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'


  def comments
    respond_to do |format|
      format.json { render json: }

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.
I used the old methods...

Thanks for your help! and support!

Join the discussion

Want to stay up-to-date with Ruby on Rails?

Join 68,326+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    logo Created with Sketch.

    Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more. Icons by Icons8

    © 2022 GoRails, LLC. All rights reserved.