Skip to content

Fix ActiveResource nested resources not being persisted #3107

Closed
wants to merge 1 commit into from

7 participants

@odorcicd

Any nested resources with an ActiveResource object are not persisted so actions such as destroy won't work.
This patches ActiveResource::Base#load to set any nested resources as persisted.

I was debating simply passing in true as opposed to attrs.has_key?(resource.primary_key.to_s), thoughts?

I also changed the setup fixtures keys in load_test.rb to be strings, to avoid calling stringify_keys everywhere (should be working with string keys anyways through ActiveResource).

@esfourteen

+1, would be nice to use methods like new? and reload on nested resources

@trybeee
trybeee commented Nov 10, 2011

+1, #update doesn't work on nested resources, trying to #create instead.

@cjolly
cjolly commented Feb 1, 2012

+1 this also breaks the dom_id method which can affect dependent javascripts and css

@anikkar
anikkar commented Feb 24, 2012

+1 this also breaks pithy link_to helpers for named routes

@carlosantoniodasilva
Ruby on Rails member

Active Resource is not part of Rails core anymore, it was extracted to its own repo. Please make sure you test with the latest version - 3.2 in this case - and if the issue still persists, feel free to open a pull request there. I'm closing the issue here, thanks!

@dguerri
dguerri commented Jul 10, 2012

+1 could you please submit this to the active resource repo ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.