Devise Suspendable gem failure due to reliance to Activatable module - ruby-on-rails

I get the following error trying to use the devise_suspendable gem.
/home/graeme/.rvm/gems/ree-1.8.7-2011.03#epra/gems/devise-1.4.5/lib/devise/models.rb:60:in `const_get': uninitialized constant Devise::Models::Activatable (NameError)
It's trying to use the activatable module in Devise but I have a feeling it's been deprecrated.
I've tried running with the suspendable module included, but ignoring the activatable module. I don't get any errors, but it doesn't stop a suspended user from logging in either.

While I haven't found a solution for this problem exactly, it turns out to be quite easy to use the lockable module in Devise instead.

Related

block in load_missing_constant': uninitialized constant API::V1::Users (NameError)

Im trying to set up api endpoints for my rails application and keep receiving this error my environment is Ruby 2.6 and Rails 5.2 and im using the 'grape' gem for the api here is the blog I followed to set it up. https://medium.com/#ryanwaldorf/how-to-add-an-api-to-an-existing-rails-app-1d2419ba91bd
here is a link to my repo https://github.com/jslack2537/apiDemoApp
I believe the issue is wither in my config/routes.rb or my application.rb files.
But I could be totally wrong. This is a challenge app and not going to be used in production.
This mainly occurs when naming conventions doesn't match. Try changing api/v1/user.rb to api/v1/users.rb which also the blog suggests. You missed a 's'.

uninitialized constant Users::RegistrationsController::Shortener Devise + Gem

I'm using a gem called Shortener: https://github.com/jpmcgrath/shortener
Its goal is to shorten some urls of my website such as www.mywebsite.com/users/sign_up?&invitcode="test" would become www.mywebsite.com/shorturl.
I meet a problem in my Devise registration_controller.rb where I'm trying to use this gem. When I called it with Shortener::ShortenedUrl.generate("www.example.com") I get a uninitialized constant Users::RegistrationsController::Shortener.
If I do the same command in my console, it's working perfectly. I guess it's because Rails cannot find Shortener in my devise module? Can you tell me how I should solve this?

Can I use Rails gem from another gem?

I am developing a simple gem. as part of it, I want data-caching to which I need rails gem. I included the required statements in gemspec. But still, it is not loading Rails. I am getting below error
NameError:
uninitialized constant FormattingHelper::Rails
Instead of using Rails for caching, I used below class and fixed the problem
ActiveSupport::Cache

undefined method 'authorize' with Pundit

I've installed the gem Pundit in my Rails app, and have followed the instructions in the README carefully.
However, when I use authorize in any of my controllers, I get the error message "undefined method 'authorize' for .
Also, when I try to use "policy" in a view, I get the error "undefined method 'policy'".
It's as if Pundit weren't installed at all!
I've included Pundit in my Application Controller.
I have an ApplicationPolicy file with all of my policies, then policy files for each type of record that inherit from the Application Policy.
For some reason, I can't paste any of my code into this question, so I'm hoping I've included enough information!
I'd appreciate any thoughts.
I have recently used pundit and it worked like a charm.
your error messages makes me infer that you've not run install
rails g pundit:install or your policies file are not in correct directories.
or if they are then Just restarting the server should fix this. Hopefully.
For me, I was missing include Pundit at the top of my ApplicationController. Adding that line fixed it.
You need to generate a default policy file for your application with the pundit:install generator.
rails g pundit:install
create app/policies/application_policy.rb

NoMethodError when attempting to use open_id_authentication

I'm currently adding OpenID login support for a Rails 3.0.0 application.
I have already installed ruby-openid (the gem) and open_id_authentication (the plugin). However, after following the steps required to set up both (from the READMEs), I am still getting this error:
undefined method `authenticate_with_open_id'
I tried Googling the problem, but most threads seem to date from years ago and remain suspiciously unanswered.
Am I missing something obvious? What is causing this problem? Note that I have had no problems switching to file-based stores in environment.rb, so I am sure that the plugin is correctly installed.
Update: Some unresolved problems of the same nature:
http://railsforum.com/viewtopic.php?id=23151
Experiencing a similar error; oddly, I have this working on Rails 3.2 on another branch, and can't figure out the difference; anyhow I found that I got a little further by following suggestions here: Rails 3.0.9 + open_id_authentication
That is, adding the line include OpenIdAuthentication after class SessionsController < ApplicationController:
class SessionsController < ApplicationController
include OpenIdAuthentication
But now I get a Completed 401 Unauthorized in my log, and see a blank page -- just and tags. Ugh.
Update: Ooh, got further; I followed this post: open_id_authentication - "OpenIdAuthentication.store is nil. Using in-memory store." problem
and as they suggested, "added an initializer named config/initializers/openid.rb with this inside":
require 'open_id_authentication' # this was needed, but not described in the referred-to post
OpenIdAuthentication.store = :file
I was then directed to the OpenId provider and was able to click "allow", but on returning to my app, I now see:
NoMethodError in SessionsController#create
undefined method `encoding' for nil:NilClass
Anyhow, finally, I found a restful routes problem and fixed that, and now logging in works!

Resources