ruby on rails - Calling method from subclass results in "no superclass method `sign_up_params' for ...". Why? -
background
i have subclassed devise::registrationscontroller
handle user registrations myself class named deviseuserscontroller
.
i need override create
action - had used super
performed additional things needed done, however, no longer satisfy requirements.
so checked out devise code on github , tried recreate few adjustments. however, have had problems starting first line...
the code
class deviseuserscontroller < devise::registrationscontroller ... def build_resource super end def sign_up_params super end def create build_resource(sign_up_params) ... end end
the error
super: no superclass method `sign_up_params' #<deviseuserscontroller:0x007f8f2d09a538>
the question
why error occurring? based on devise::registrationscontroller code evident method, not private, exists.
versions:
- rails 3.2.13
- ruby 1.9.3
- devise 2.2.3
edit changing code to:
class deviseuserscontroller < devise::registrationscontroller ... def create build_resource(sign_up_params) ... end protected def build_resource super end def sign_up_params super end end
still not work.
if watch carefully, you'll see protected
before bunch of methods including sign_up_params
.
well, have it's not significant, use local repo can find :)
in sub class, method sign_up_params
public method. in fact there no such public method in parent class. error correct.
to solve, think can set method sign_in_params
in subclass protected, though have not verified that.
Comments
Post a Comment