Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

For example, we have something like this. We want to activate user after submit #64

Open
kalashnikovisme opened this issue May 15, 2024 · 0 comments

Comments

@kalashnikovisme
Copy link
Contributor

For example, we have something like this. We want to activate user after submit

class UserForm < Tramway::BaseForm
  def submit(params)
    super.tap do |result|
      object.activate if result == true
    end
  end
end

Maybe we should implement callbacks in Tramway Form to be able do something like this?

class UserForm < Tramway::BaseForm
  after_submit -> { object.activate }
  after_resist -> { object.deactivate }
end

I think it will allow to us do something this too

class Users::RejectForm < Tramway::BaseForm
  properties :reject_reason

  after_submit -> { user.reject }
end

What do you think?

Originally posted by @kalashnikovisme in #47

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant