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

Support Updating of Slug #28

Open
allenwyma opened this issue Nov 22, 2024 · 0 comments
Open

Support Updating of Slug #28

allenwyma opened this issue Nov 22, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@allenwyma
Copy link

Is your feature request related to a problem? Please describe.
When a value is updated, the slug doesn't seem to update.

Describe the solution you'd like
The function should apply whenever the value has been updated.

It'd also be nice to have a "callback" where we can keep track of the last value, and we can say insert that into a table and redirect old slugs to the new slug for bookmarked pages, etc.

Describe alternatives you've considered
This may be possible to be done as is, but I htink having this in the DSL, would be better to have as it's more clear and realted to ash_slug.

Express the feature either with a change to resource syntax, or with a change to the resource interface

Existing:

  actions do
    update :update do
      change slugify(:name, into: :slug)
    end
  end

To

 ash_slug do
  slugify(:name, into: slug), on: [:create, :update] do
     change fn changeset ->
     # do what you want with the old value, etc.
     end
  end
 end

Additional context
Add any other context or screenshots about the feature request here.

@allenwyma allenwyma added the enhancement New feature or request label Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant