in the
respond_with(resource,serialize_options(resource))
In the end, I think we have passed the process to .erb
.
respond_with
does not work
def serialize_options(resource)
methods=resource_class.authentication_keys.dup
methods=methods.keys if methods.is_a?(Hash)
methods<<:password if resource.respond_to?(:password)
{ methods:methods, only: [:password]}
end
So, I'm creating a Hash with methods
and only
as keys, and respond_with
seems to take this Hash as an argument...what do these two keys mean?
I don't fully understand it, but I somehow understood the role by looking at this commit (especially the test).
https://github.com/plataformatec/devise/commit/3cedba1de8345b5f5f9055acd5513e893ed8d497
The methods use authentication_keys in config/initializers/device.rb.
The default is:email.
#config.authentication_keys=[:email]
If you change this to :subdomain, it seems that user.subdomain is used instead of user.email during authentication.(Probably)
config.authentication_keys=[:subdomain]
Also, wouldn't it be possible to use GitHub's blame or history to trace the commit log back, or to slowly debug using pry or RubyMine to solve other unclear points?
That's all for your information.
© 2024 OneMinuteCode. All rights reserved.