-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Add support for selectable strings on edit pages #422
Add support for selectable strings on edit pages #422
Conversation
[1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/Select | ||
%> | ||
|
||
<%= field.data.presence %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the .presence
necessary? I would expect it to behave the same without it, because the result is getting rendered as a string either way.
I really like this! I left a few small comments. |
@@ -4,6 +4,11 @@ class Customer < ActiveRecord::Base | |||
validates :name, presence: true | |||
validates :email, presence: true | |||
|
|||
KINDS = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Freeze mutable objects assigned to constants.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This array is frozen -- Hound isn't catching that it's a couple lines down.
a03bc27
to
2ac9189
Compare
@Graysonwright Addressed your concerns; will squash whenever you're ready. |
Looks great! Merged in as 3bccdb3. |
Hm - this conflicts with my gem https://rubygems.org/gems/administrate-field-select and is missing some of the features of that gem. I'll rename the class in my gem so it doesn't conflict but perhaps we can work together to merge the two concepts into one at some point? |
This pull request adds support for collection select fields, much like
simple_form
'scollection: [:foo, :bar]
option. This also provides a base field that will be helpful in implementing theHasOne
field that is currently pending implementation.Example User Story
As a developer
I want to allow administrative users to select values from a drop-down rather than enter them free-form
So that I don't need to worry quite as much about data integrity in my administrative interface
And so that my users have a streamlined user experience.