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.
Some days ago, I was requested to enable to load seed data from excel, by my client, in rails 4 project. I told that data to be edited should be managed in database, not excel. But he really requested excel, then I and he decided load data from tsv. Excel is functional, so TSV is appropriate.
Select data area and copy and paste with mouse, Excel data can be pasted as TSV data to text editor, and vise versa.
Environment
Ubuntu 14.04 LTS
Rails 4.1.8
Ruby 2.2.2
Direction
Create feature to load TSV data as a task, and enable to execute with rake.
On executing rake db:seed, execute the task to load TSV.