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

Ask A Question

Notifications

You’re not receiving notifications from this thread.

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

Victor Nizeyimana asked in Databases

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!

Join the discussion

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

Join 37,344+ 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.

    Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

    © 2020 GoRails, LLC. All rights reserved.