Skip to content

Releases: piotr-galas/rails_form_object

Add naming

14 Oct 21:01
Compare
Choose a tag to compare

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)