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

Adding a new method to action classes to return permitted param declarations #1122

Merged
merged 2 commits into from
Apr 29, 2020

Conversation

jwoertink
Copy link
Member

Purpose

This is a precursor to #1070

Description

Before this PR there was no way to know what params have been defined on an Action class. Also interesting thing, calling something like Users::Index::PARAM_DECLARATIONS would throw an exception that Crystal::Macros::TypeDeclaration was undefined. I guess that constant only lives inside of macros...

Well, now we have a method called permitted_query_params on the class. This will be useful for adding which params are allowed in a route when running lucky routes.

Checklist

  • - An issue already exists detailing the issue/or feature request that this PR fixes
  • - All specs are formatted with crystal tool format spec src
  • - Inline documentation has been added and/or updated
  • - Lucky builds on docker with ./script/setup
  • - All builds and specs pass on docker with ./script/test

Copy link
Member

@paulcsmith paulcsmith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Just one comment on a name for it

spec/lucky/action_spec.cr Outdated Show resolved Hide resolved
@jwoertink jwoertink merged commit f501863 into master Apr 29, 2020
@jwoertink jwoertink deleted the features/action_params branch April 29, 2020 15:38
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

Successfully merging this pull request may close these issues.

2 participants