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'
Related
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>'
I am updating from Rails 3 to Rails 4.2, and when I run my application's test suite, I get the following error:
Failure/Error: get 'edit', id: #shops[3].id
NoMethodError:
undefined method `map!' for #<Shop::ActiveRecord_Relation:0x007ff1d69b4f40>
The code in the controller is:
existing_shops.map! { |obj| [["##{obj[:shop_id]} #{obj[:name]},
#{obj[:phone]}, #{obj[:address]}, #{obj[:city]}, #{obj[:state]}, #{obj[:zipcode]} "]]}
I am using Rails 4.2.4 and RSpec 3.3.0.
Relation no longer has mutator methods like #map! and #delete_if. Convert to an Array by calling #to_a before using these methods.
existing_shops.to_a.map! { ... }
— A Guide for Upgrading Ruby on Rails
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)
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
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?