https://github.com/afeiship/nx-permit-fields
Permit fields for rails.
https://github.com/afeiship/nx-permit-fields
exclude fields nx permit
Last synced: about 1 year ago
JSON representation
Permit fields for rails.
- Host: GitHub
- URL: https://github.com/afeiship/nx-permit-fields
- Owner: afeiship
- Created: 2020-03-15T18:16:39.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-03-15T18:40:38.000Z (about 6 years ago)
- Last Synced: 2025-01-06T08:08:54.404Z (about 1 year ago)
- Topics: exclude, fields, nx, permit
- Language: Ruby
- Size: 21.5 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# nx-permit-fields
> Permit fields for rails.
## installation
```rb
# from gem
gem 'nx-permit-fields'
# from git
gem 'nx-permit-fields', git: 'git@github.com:afeiship/nx-permit-fields.git'
```
## usage
```rb
# before: --------------------------------
# [
# :title,
# :summary,
# :image,
# :douban_rate,
# :author,
# :translator,
# :publishing_house,
# :publishing_at,
# :ext,
# :catalogue,
# :douban_url,
# :image_marked,
# :isbn
# ]
Nx::PermitFields::exclude(:post, fields:[:ext, :image_marked])
# after:
# [
# :title,
# :summary,
# :image,
# :douban_rate,
# :author,
# :translator,
# :publishing_house,
# :publishing_at,
# :catalogue,
# :douban_url,
# :isbn
# ]
```
## build/publish
```shell
# build
gem build nx-permit-fields.gemspec
# publish
gem push nx-permit-fields-0.1.0.gem
```
## resources
- https://stackoverflow.com/questions/1235593/ruby-symbol-to-class