설명서를 읽었지만 구문/형식을 고수 할 수는 없습니다.레일 4.0의 강력한 매개 변수 간략한 구현 구현
나는 꽤 새로운 레일입니다. 내 모델에이 있습니다 :
attr_accessible :email, :username
레일 4.0의 변경 사항 때문에 컨트롤러로 옮겨야합니다. ,
before_filter :configure_permitted_parameters, if: :devise_controller?
protected
def configure_permitted_parameters
devise_parameter_sanitizer.for(:sign_up) << :username
end
나에게 뭔가를이 더 의미처럼 : 내 컨트롤러에서이 그것이 올바른 것 넣으면
는 (이것은 내가 문서는 내가 올바르게 해석하지만 만약 확실하지 않습니다 말한다 생각입니다) 내가 할 수 있을까요? :
protected
def permitted_paramters
params.require(:username, :email).permit(:username, :email)
end
의견을 보내 주셔서 감사합니다.
이에서보세요 - http://stackoverflow.com/questions/11904105/devise-and -strong-parameters – cristian
레일 4에서는'attr_accessible'을 쓸 필요가 없습니다.) –
@RichPeck 그래서 컨트롤러를 완전히 닫고 아무것도하지 말아야합니까? 무슨 소리 야? – user3408293