-
Please check following code: I have a class SaveUser < User::SaveOperation
attribute password : String
attribute password_confirmation : String
before_save do
validate_required password
validate_confirmation_of password, with: password_confirmation
end
end
with two action use it. class User::Htmx::Editable < HtmxAction
put "/users/:id/editable" do
user = UserQuery.find(params.get(:id))
SaveUser.update!(user, is_editable: !user.is_editable)
plain_text "ok"
end
end And class User::Htmx::Password < HtmxAction
put "/users/:id/password" do
user = UserQuery.find(params.get(:id))
SaveUser.update!(
user,
password: params.get(:password),
password_confirmation: params.get(:password_confirmation)
)
plain_text "ok"
end
end When i first add the Then when i add the
One of the solution is, split the Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
I solve this issue with pass a |
Beta Was this translation helpful? Give feedback.
I think this is what I would do, actually. Alternatively, you can just use
User::SaveOperation.update!(user, is_editable: !user.is_editable)
which will circumvent any callbacks and keep the SaveUser to just updating the password