Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

undefined method with for Model #42

Closed
lalitlogical opened this issue Jul 31, 2020 · 3 comments
Closed

undefined method with for Model #42

lalitlogical opened this issue Jul 31, 2020 · 3 comments

Comments

@lalitlogical
Copy link

lalitlogical commented Jul 31, 2020

I have followed the installation step as below.

Add this line to your application's Gemfile:

gem 'active_record_extended'
And then execute:

$ bundle

Why I'm still getting the below issue?

irb(main):002:0> Developer.with
Traceback (most recent call last):
        1: from (irb):2
NoMethodError (undefined method `with' for Developer (call 'Developer.connection' to establish a connection):Class)
irb(main):003:0>

Rails version: gem 'rails', '~> 5.1.4'
Ruby version: ruby-2.5.0

Should I have to require any module manually in Models?

@lalitlogical lalitlogical changed the title undefined method with for Developer undefined method with for Model Jul 31, 2020
@lalitlogical
Copy link
Author

Finally, I figure out the issue. We have to require the below into application.rb

require "active_record_extended"

But it should be mentioned in ReadMe for better clarity.

@leoplct
Copy link

leoplct commented Dec 18, 2020

Same problem. I have added it "require "active_record_extended" but still not working.

config/application.rb

require_relative 'boot'
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)

# CUSTOM
require "active_record_extended"

@GeorgeKaraszi
Copy link
Owner

GeorgeKaraszi commented Dec 18, 2020

odd, I've worked on many projects with this gem. Not once have I ever had to explicitly require it.

It might be related to how your project's are setup and more so autoloaders.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants