-
Notifications
You must be signed in to change notification settings - Fork 92
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
Nested Attributes? #13
Comments
Yes, I have one
It will be greate to have some like |
Got it, that sounds like a nice addition 🙂 Feel free to come up with a PR if you're interested in playing with the gem, otherwise I'll take a look at it next week |
Hi @exsemt! I've added a couple of tests for nested attributes, and it looks like for your case concept.update(id: 1, name: "name", values: [{ name: "name }]) or concept = Concept.last
concept.values = [ConceptValue.new(name: "name)]
concept.values should work of the box. What usecase am I missing here? |
Correct, that works, but it does not work as an Active Record Nested Attributes
|
Here we go #17 - could you please try it out before I merge it in? |
Released 0.4.0 with |
Thanks! Sorry that took so long time to check it, it works fine for
|
Here is a PR with a possible fix. The only thing is that in Rails only Hash and Array are accepted, so the param should be either |
Thx! Works! 👍 |
I tried adding validatation on nested attributes but it gave me the error "NoMethodError (undefined method `type_for_attribute' for ...)"
|
Hi @jsice! Thanks for the report, I'll do my best to investigate this issue later this week |
Thanks! |
Hey all, firstly this is a really cool gem and it will hopefully make my life way easier! I've just started playing around with it and have the following set up
When I submit the update form on the pathogen my params look like
but when I call update on the pathogen model it does not save the nested susceptibility attributes and instead returns just nil
I'm thinking I am just doing something small wrong...any help would be greatly appreciated! |
Hey @evanshabsove, I'm not sure it will help, but just in case, take a look here: #41 I didn't even know there is an |
I ended up figuring it out! I was trying to be too cute with it. We use Inherited Resources (https://github.com/activeadmin/inherited_resources) and I was hoping the update! method in that would magically take care of everything, but I was wishing too hard. Changing the assignment to just
Fixed everything. @FunkyloverOne thanks for linking me to the issue thread! Looking at this though I wonder if I just remove the :configuration part of the param I can be cute with it...anyways a discussion for another place. |
I know this is an old issue, but I stumbled upon an error when using shoulda matchers:
This leads to this line https://github.com/thoughtbot/shoulda-matchers/blob/main/lib/shoulda/matchers/active_record/accept_nested_attributes_for_matcher.rb#L196 Is there something missing inside store model? |
Right, this method was not ported 😞 |
Is there any chance, this method gets ported in the next release? |
Sure, I just need a volounteer and will be happy to review the PR! 🙂 |
any updates? |
Hi @DmitryTsepelev,
are you planning to add the
accept_nested_attributes_for
function to the store_model?The text was updated successfully, but these errors were encountered: