-
-
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
Add tests for PR 1699 #1782
Add tests for PR 1699 #1782
Conversation
Two level deep... Whoah! Anyone can test this and confirm that it works? |
def js_for_has_many(association, form_block, template) | ||
association_reflection = object.class.reflect_on_association(association) | ||
association_human_name = association_reflection.klass.model_name.human | ||
placeholder = "NEW_#{association_human_name.upcase}_RECORD" |
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.
@danielwestendorf It looks like what you fixed in #1789 is still present here, right? I'll make sure to fix it.
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.
Yes, I was going to comment on this pull but you beat me to it!
@pcreux I will provide a sample Rails app that demonstrates the feature. |
@ptn This would be awesome! |
When generating the html that form builder's #has_many replaces via JS, the placeholder that it looks for cannot contain spaces, otherwise, JS's replace method won't replace all that it was supposed to. This was originally implemented by @danielwestendorf in PR activeadmin#1789
@pcreux The sample app is here: https://github.com/ptn/aa-sample-1782 In the app, an Adventure has many Days which have many Activities; that's the 2-level nesting. To test:
Since @jpmckinney merged the original code, maybe he'd like to read this too? |
Awesome! |
I am facing the same issue. I checked out the sample rails application and it perfectly works on local environment. I also downgraded all my gems (rails, activeadmin, jquery-rails) to match the ones in the sample application, but no luck. Here is the Gemfile.lock and the admin form config I am using https://gist.github.com/aakashd/5531908. Can someone please take a look at this and let me know if I am missing something? |
Did you test on master?
|
Yes, I tested this on master. Is there a particular part of the codebase that you would want me to check or debug? |
Pull request #1699 added the ability to work with two-levels-deep has_many relationships via the form builder. This adds tests for that.