configure warden rails - ruby-on-rails

I started my rails app and suddenly got the following error
/.rvm/gems/ruby-1.9.3-p194/gems/devise-2.1.2/lib/devise.rb:406:in `configure_warden!': undefined method `failure_app=' for nil:NilClass (NoMethodError)
devise.rb line 406 has:
warden_config.failure_app = Devise::Delegator.new
I cannot figure out the problem, how do i go about this?

Related

undefined method `create!' for ActiveAdmin Comments

ActiveAdmin suddenly started to display this error when I try to create a comment on any model.
NoMethodError in Admin::CommentsController#create
undefined method `create!' for #<Admin::CommentsController:0x00007f9a6b2a5640> Did you mean? create
I have the latest ActiveAdmin version 2.13.1, ruby 3.2 and rails 6.1
This error comes from: activeadmin (2.13.1) lib/active_admin/orm/active_record/comments.rb:66:in `create'

Rails Rich Text (Trix) return NoMethodError: undefined method `render' for nil:NilClass

When I try to run a rake task, Trix return this error NoMethodError: undefined method "render" for nil:NilClass in this file:
/bundle/ruby/2.7.0/gems/actiontext-6.0.0/lib/action_text/content.rb:91:in `to_rendered_html_with_layout'
/bundle/ruby/2.7.0/gems/actiontext-6.0.0/lib/action_text/content.rb:95:in `to_s'
/bundle/ruby/2.7.0/gems/actiontext-6.0.0/app/models/action_text/rich_text.rb:12:in `to_s'
In console, in development environment, when I request a model instance and get model.content works. But, when I request this in rake task (paused by byebug or printing with puts) I get this error: *Error in evaluation*.
In normal runnig everything is working, same for rails console. This error shows only in rake task, even though I just fetching the model from the database and trying to call model.content.
model.content is not blank.

Rails Hartl Tutorial: Unable to Fix NoMethodError in PasswordResetsTest

I am getting the following NoMethodError even though my database table has the reset_sent_at column and User.last.reset_sent_at is not nil.
I will appreciate if anyone can help in fixing this error. Thanks.
PasswordResetsTest#test_password_resets:
NoMethodError: undefined method `reset_sent_at=' for #<User:0x00007f8e34164210>
Did you mean? reset_token=
app/models/user.rb:66:in `create_reset_digest'
app/controllers/password_resets_controller.rb:14:in `create'
test/integration/password_resets_test.rb:19:in `block in <class:PasswordResetsTest>'

Kaminari undefined method `page' with Rails 4.2

I am using Kaminari 0.16.3 with Rails 4.2.0. Not sure what is going wrong, I have pasted code run by me in console, which proves kaminari gem is loaded but page method is undefined on ActiveRecord model.
abhishek#abhishek ~/my_app (master●●)$ rails c [ruby-2.1.5p273]
Loading development environment (Rails 4.2.0)
irb(main):001:0> Kaminari
=> Kaminari
irb(main):002:0> User.page
NoMethodError: undefined method `page' for User (call 'User.connection' to establish a connection):Class
Please note: I am intentionally calling page without any arguments to reproduce the issue.
Due to an issue with will_paginate and rails_admin I had this in my codebase causing the page method to be renamed to per_page_kaminari.
I have realized this late and fixed.
Kaminari.configure do |config|
config.page_method_name = :per_page_kaminari
end
Have a look at this tutorial https://github.com/amatsuda/kaminari
This is how it works
User.page(page_number).per(records_per_page)

RSpec: undefined method `infer_spec_type_from_file_location!' for #<RSpec::Core::Configuration:0x00000103bc6020> (NoMethodError)

I am writing some tests for my Rails controller, and I am using RSpec 3.0.2
After getting this error, when I try to simulate a POST call to a route:
NoMethodError:
undefined method `post' for # <RSpec::ExampleGroups::WebApplicationsController::ProcessPayment:0x00000106214ce0>
I then read this SO thread and I added the following line to my spec_helper.rb
RSpec.configuration.infer_spec_type_from_file_location!
Which gives me the following error when I run rspec spec:
code/fsa/spec/spec_helper.rb:4:in `<top (required)>': undefined method `infer_spec_type_from_file_location!' for #<RSpec::Core::Configuration:0x0000010420e040> (NoMethodError)
I am not really sure what is going on.
This was happening due to the fact that I was using gem 'rspec' instead of gem rspec-rails

Resources