This question is related to one that I asked a couple years ago:
Instantiating Devise user models manually using contents of params hash
I am not sure if this is a rails 4 issue, but I am finding that I cannot manually instantiate devise user in my controller code. This used to work in rails 3.
class RegistrationsController < Devise::RegistrationsController
...
def schema_test
@user = User.new(:email => '[email protected]', :password => 'asdf123', :password_confirmation => 'asdf123')
@user.save
end
...
end
This is the devise-specific part of my routes.rb: devise_for :users, :controllers => {:registrations => "registrations"}
devise_scope :user do
get '/schema_test', to: 'registrations#schema_test'
end
When I call schema_test, I am finding that the user object is not getting saved to the database. Does anyone have any suggestions?