https://github.com/steventen/postgresql-array
Example of PostgreSQL's Array Feature in Rails
https://github.com/steventen/postgresql-array
Last synced: about 1 year ago
JSON representation
Example of PostgreSQL's Array Feature in Rails
- Host: GitHub
- URL: https://github.com/steventen/postgresql-array
- Owner: steventen
- Created: 2014-12-31T05:13:15.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2014-12-31T05:16:35.000Z (over 11 years ago)
- Last Synced: 2025-04-03T17:23:54.019Z (over 1 year ago)
- Language: Ruby
- Size: 133 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
#Example of PostgreSQL's Array Feature in Rails
It includes only one model: Group, which has a `tags` field
`tags` field is declared as: `t.text "tags", default: [], array: true`
The input field accepts multiple tags separated by newline.
It removes duplicate tags when saving to database.
## Remove Curly Brace
By default, Rails shows curly braces `{}` in the text input field of the form.
Check [Group#formated](app/models/group.rb) method and [_form.html.erb](app/views/groups/_form.html.erb) for the changes I made.
## Issue
This example only works with Rails `4.2.0.rc1`, but fails on `4.2.0`
## Testing
The [testing code](spec/controllers/groups_controller_spec.rb) indicate that with Rails `4.2.0`, the array could not create.