RESTfully destroy polymorphic association in Rails?

In Rails 2.3 you have accepts_nested_attributes_for which would let you pass an array of ModelSurveys to the event in question. If you allow destroy through the nested attributes declaration, you'll be able to pass eventmodel_surveys1_destroy=1 and the association will be removed. Check out the api docs.

Resources domain! = model domain The domain of the controller is not the same as that of the models. It's perfectly fine to update multiple models by changing the state of a resource.In your case that means doing a PUT or POST to either the Event or the Survey which contains a list of ids for the other.

The model for one will update the association. PUT or POST Some people (but not Roy Fielding) believe that you should use a PUT to update the resource and provide all of the state again, others feel that a POST with the partial state (ala PATCH) is sufficient.

No, in the page that you linked, imageable represents a polymorphic association to either an Employee or Product. In order for the polymorphic association to work, rails will need to determine the 'type' of object (i.e. Either an Employee or a Product) by looking at the 'imageable_type' entry in the db and then the id of the respective object (imageable_id).

For example, an entry within the db of imageable_type => 'Employee' and and imageable_id => '4'. ActiveRecord would figure out that the association is to id 4 in the employees table.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions