I want to know the meaning of the serialize_options key passed by the response_with argument in Device.

Asked 2 months ago, Updated 2 months ago, 2 views


in the


In the end, I think we have passed the process to .erb.
respond_with does not work

def serialize_options(resource)
    methods=methods.keys if methods.is_a?(Hash)
    methods<<:password if resource.respond_to?(:password)
    { methods:methods, only: [:password]}

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?

ruby-on-rails ruby devise

2022-09-30 11:22

1 Answers

I don't fully understand it, but I somehow understood the role by looking at this commit (especially the test).


The methods use authentication_keys in config/initializers/device.rb.

The default is:email.


If you change this to :subdomain, it seems that user.subdomain is used instead of user.email during authentication.(Probably)


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.

2022-09-30 11:22

If you have any answers or tips

© 2022 OneMinuteCode. All rights reserved.