Henrik Ormåsen
2006-Nov-04 02:28 UTC
[Rails] @article.article_groups.delete_if... Dosn''t work!
If I try:
@article.article_groups.delete_if {|x|
x.group_id == x.group_id
}
It does nothing.
If I try:
articletmp.article_groups.each{ |x|
@article.article_groups.delete(y)
}
It deletes some of the groups.
@article.article_groups.clear
works.
Why dosn''t the to first examples work as expected??
Do I have to put groups I don''t want to be deleted inn as hidden
fields in my form? (I of course dosn''t want every groups to be deleted
as in the example above).
- Henrik
Maybe Matching Threads
- @article.article_groups.delete_if... Dosn't work!
- Select articles from group with id ''1'' and id ''2''
- delete_if does not work on associations
- shouldn''t this work? - session[:array_of_objects].delete_if {|x| x.id == params[:id]}
- delete_if doesn''t work for has_and_belongs_to_many
