Accessing Custom Parameters when using Devise and Rails 4

瘦欲@ 提交于 2019-11-30 17:04:43
Zoltan

welcome on board. :) Rails is just amazing and you will really enjoy this journey. :)

I think, here you will find your answer: https://github.com/plataformatec/devise/tree/rails4#strong-parameters

Based on above link, I think you should insert something like this in your ApplicationController:

class ApplicationController < ActionController::Base
  before_filter :configure_permitted_parameters, if: :devise_controller?

  protected

  def configure_permitted_parameters
    devise_parameter_sanitizer.for(:user) { |u| u.permit(:profile_name) }
  end
end

And I already suggested in a previous question... Strong parameters with Rails and Devise

...that you can create your own controller which could extend devise own controller. There is a gist for that: https://gist.github.com/bluemont/e304e65e7e15d77d3cb9

A little bit more details in Devise doc: https://github.com/plataformatec/devise/tree/rails4#configuring-controllers

Hope it could help, and let me know what happened.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!