Here are some exceptions I bumped into on upgrading from Cells 3 gem to Cells 4. ここにある対処法は、 それぞれの Cell クラス に対して行ってもいいですが、 it is easier to create the parent class, ApplicationCell.
The following error was raised in lib/devise/controllers/helpers.rb. The version of device gem I used at that time was 3.5.2.
undefined method `helper_method’ for XyzCell:Class
Add the following code to Cell class.
Ruby
1
2
defself.helper_method(*)
end
It is empty method but there’s no problem. With Cells 3, we have to call self.helper_method but with Cells 4 we don’t have to do that and its method was removed.
I bumped into the following error when I was creating API program. The origin was devise gem.
NoMethodError (undefined method `failure_app’ for nil:NilClass)
Environment
Ruby 2.2.3p173
Rails 4.2.4
devise 3.5.2
Origin
I used sign_in method for unauthorized user.
The API in construction, we have to make unauthorized user able to login, so I wrote logging in procedure for all users, including unauthorized users. Then, devise and warden rejected unauthorized user and raised error.
Solution
Write the following setting into config/initializer/devise.rb.
Ruby
1
config.allow_unconfirmed_access_for=2000.years
Or write the following method into the model class that is used by devise for authentication. User class for example.
Ruby
1
2
3
4
private
defconfirmation_period_valid?
returntrue
end
I recommend latter solution.
confirmation_period_valid?
confirmation_period_valid? method is defined at the module Devise::Models::Confirmable of devise gem.