Displaying 2 results from an estimated 2 matches for "lab_desc_id".
2010 Mar 24
3
More elegant solution for "missing" has-many through ids?
I have LabGroup and LabDesc which have many through LabDescGroup. I''d
like to identify LabDescs which don''t have a LabGroup. This works:
x = []
LabDescGroup.find( :all, :select => ''DISTINCT lab_desc_id'' ).each{ |c|
x << c.lab_desc_id }
y = []
LabDesc.find( :all, :select => ''id'' ).each{ |c| y << c.id }
notfound = x - y
But is there a more elegant way? It feels like I should be able to do
this entirely through queries, but I''m not seeing the solu...
2010 Mar 23
0
Frozen hash problem
...troy
end
raise lab_datas.to_yaml
end
But nothing seems to be deleted in the hash:
---
- &id001 !ruby/object:LabData
attributes:
created_at: 2010-03-21 22:16:06
unit_id: "3"
lab_id: "81"
updated_at: 2010-03-21 22:16:06
id: "184"
lab_desc_id: "6"
value: "29"
attributes_cache: {}
changed_attributes: {}
errors: !ruby/object:ActiveRecord::Errors
base: *id001
errors: {}
And if I remove the "raise", the controller throws a "can''t modify
frozen hash" error.
Any idea how I...