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 devise with 2.6.1 #65

Closed
exadeci opened this issue Jun 9, 2020 · 6 comments
Closed

Undefined method devise with 2.6.1 #65

exadeci opened this issue Jun 9, 2020 · 6 comments
Labels
bug Something isn't working

Comments

@exadeci
Copy link

exadeci commented Jun 9, 2020

Steps to reproduce

  • Setup a project with devise and ros-appartment 2.6.1
  • Add devise to a user model
  • Add the model to the excluded_models

Expected behaviour

No error

Actual behaviour

/Users/gaetan/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/dynamic_matchers.rb:22:in `method_missing': undefined method `devise' for #<Class:0x00007ffe6480f240> (NoMethodError)

System configuration

  • Database: (Tell us what database and its version you use.) Postgres 12

  • Apartment version: 2.6.1

  • Apartment config (in config/initializers/apartment.rb or so):

    • use_schemas: true
  • Rails (or ActiveRecord) version: Rails 6.0.3.1

  • Ruby version: ruby 2.6.5p114

Downgrading to 2.6.0 fixes the issue.

@rpbaltazar
Copy link
Contributor

I'll try to reproduce the problem on my side. I'm running a project with that setup and i don't see any issues yet. will start with a clean project and see if i can reproduce it

@rpbaltazar
Copy link
Contributor

I just tried to spin up a brand new rails project and it seems to work for me. can you open a repository where you can replicate the case? is it possible that you don't have your config/initializers/devise.rb file in the project? I'm able to reproduce it only if i remove the devise initializer.

@rpbaltazar rpbaltazar added the bug Something isn't working label Jun 12, 2020
@andreslemik
Copy link

@exadeci try to rename config/initializers/devise.rb to config/initializers/00_devise.rb. It's because during apartment initialization loading User model that's depend from devise, which not loaded yet.

@rpbaltazar
Copy link
Contributor

I assume this is caused due to initializer loading the files in the wrong order and not related to apartment anyhow.

@exadeci
Copy link
Author

exadeci commented Jul 9, 2020

@rpbaltazar Yeah it was a load order issue.

Moving my CustomElevator.excluded_subdomains = before Apartment.configure fixed it.

@rpbaltazar
Copy link
Contributor

If you think it should be added to the documentation, please feel free to submit a PR to update the readme accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants