Search code examples
ruby-on-railssinatra

Getting NoMethodError - undefined method even though the method doesn't exist


I have a Sinatra app where when I visit a url, it's trying to retrieve data from the previous code somehow. For ex, previously Users controller had some code to retrieve users and currently I have deleted everything. It still gives the below error:

NoMethodError at /testers/v1/users
undefined method `default_user_id'

I have even removed `default_user_id' from the model, schema, migration and doesn't appear in the table in Postgres.

schema.rb:

create_table "users", force: :cascade do |t|
    t.string "code", limit: 10, null: false
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
end

controller:

module Testers
  module V1
    class UsersController
      get '/' do
        success(200, 'result')
      end
    end
  end
end

Solution

  • It seemed to work after resetting the database db:reset