-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
[1093] HABTM Select Filters #1928
[1093] HABTM Select Filters #1928
Conversation
This is now fully working. Thoughts @macfanatic? |
if method.present? && options[:as] ||= default_input_type(method) | ||
form_buffers.last << input(method, options) | ||
else | ||
'' |
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.
Why doesn't this empty string get appended to the form_buffers
array?
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.
I have no idea; that's just how the original code was implemented.
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.
Ultimately what it's doing is calling our FormBuilder version of input
:
def input(method, *args)
content = with_new_form_buffer{ super }
@inputs_with_block ? form_buffers.last << content : content
end
So the code in question should be simplified to be this instead:
def filter(method, options = {})
if method.present? && options[:as] ||= default_input_type(method)
input(method, options)
end
end
@daxter - Other than my 1 question, looks good to me. |
As it happens, 70d1df0 implements the things I described in #2123 💃 |
The logs on Travis are completely unreadable... Guess I'll have to build a Rails 3.0 test app and run everything locally. |
Assuming Foo HABTM Bars, the below now works as you'd expect: ```ruby ActiveAdmin.register Foo do filter :bars end ```
+ `filter :attr, as: :select` now plucks DB values by default + properly add default polymorphic filters + move common Formtastic overrides into a single module
[1093] HABTM Select Filters
For #1093
filter :attr, as: :select
now utilizesActiveRecord#pluck
when using Rails >= 3.2 (resolves Better defaults for filters #2123)