Skip to content

Add naming

Latest
Compare
Choose a tag to compare
@piotr-galas piotr-galas released this 14 Oct 21:01

Add option :as which allows adding custom form_object name independent of the name of form object class.
It is necessary when we use strong_parameters and form_for helper.

  class UserEditFriendData < RailsFormObject::Base
   ...
  end

and strong_parameters should looks: params.require(:user_edit_friend_data).permit(:something)

With option :as it is possible to:

  class UserEditFriendData < RailsFormObject::Base
    as: :user
  end

and strong_parameters should looks: params.require(:user).permit(:something)