# Problem with .save when model has two HABTM

**URL:** <https://www.ruby-forum.com/t/problem-with-save-when-model-has-two-habtm/50129>\
**Category:** Rails\
**Created:** [December 13, 2005, 11:46am UTC](https://www.ruby-forum.com/t/problem-with-save-when-model-has-two-habtm/50129 "2005-12-13T11:46:20Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![mattias](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/cab0a1/32.png) [@mattias](https://www.ruby-forum.com/u/mattias)\
**Post date:** [December 13, 2005, 11:46am UTC](https://www.ruby-forum.com/t/problem-with-save-when-model-has-two-habtm/50129/1 "2005-12-13T11:46:20Z")

</div>

I have a problem with save on a model that contains two HABTM. When  
create (save) only the categories are saved - the archives\_medias table  
stays untouched. On update both tables are updated.  
This is how it looks now:

class Archive \< ActiveRecord::Base  
has\_and\_belongs\_to\_many :categories  
has\_and\_belongs\_to\_many :medias  
…

class ArchivesController \< ApplicationController

```
def create
@archive = Archive.new(params[:archive])
if request.post? && @archive.save
  flash[:notice] = 'Archive was successfully created.'
  redirect_to :action => 'list'
else
  render :action => 'edit'
end

```

def update  
@archive = Archive.find(params[:id])  
if request.post? && @archive.update\_attributes(params[:archive])  
flash[:notice] = ‘Archive was successfully updated.’  
redirect\_to :action =\> ‘list’  
else  
render :action =\> ‘edit’  
end

The values of categries and medias are passed through checkboxes useing  
the categories\_ids and media\_ids arrays.

I can’t confirm it but I suspect this problem first accured after I  
updated to 0.14.4. The model gets the data fine on both.

Strange?

---

<div class="post-metadata">

**Author:** ![mattias](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/cab0a1/32.png) [@mattias](https://www.ruby-forum.com/u/mattias)\
**Post date:** [December 13, 2005, 11:52am UTC](https://www.ruby-forum.com/t/problem-with-save-when-model-has-two-habtm/50129/2 "2005-12-13T11:52:30Z")

</div>

I have encountered the exact same problem and have yet to find a  
solution. hopefully someone can figure this quirky behavior out.

-A

---

<div class="post-metadata">

**Author:** ![mattias](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/cab0a1/32.png) [@mattias](https://www.ruby-forum.com/u/mattias)\
**Post date:** [December 13, 2005, 12:40pm UTC](https://www.ruby-forum.com/t/problem-with-save-when-model-has-two-habtm/50129/3 "2005-12-13T12:40:12Z")

</div>

Mattias B. wrote:

> I have a problem with save on a model that contains two HABTM. When  
> create (save) only the categories are saved - the archives\_medias table  
> stays untouched. On update both tables are updated.

Perhaps it’s related to the pluralization and singularization of  
“media”.

–  
We develop, watch us RoR, in numbers too big to ignore.

---

<div class="post-metadata">

**Author:** ![mattias](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/cab0a1/32.png) [@mattias](https://www.ruby-forum.com/u/mattias)\
**Post date:** [December 13, 2005, 2:52pm UTC](https://www.ruby-forum.com/t/problem-with-save-when-model-has-two-habtm/50129/4 "2005-12-13T14:52:51Z")

</div>

Mark Reginald J. wrote:

> Mattias B. wrote:
> 
> > I have a problem with save on a model that contains two HABTM. When  
> > create (save) only the categories are saved - the archives\_medias table  
> > stays untouched. On update both tables are updated.
> 
> Perhaps it’s related to the pluralization and singularization of  
> “media”.
> 
> –  
> We develop, watch us RoR, in numbers too big to ignore.

I have tried to specify both:

:class\_name =\> ‘Media’,  
:join\_table =\> ‘archives\_medias’,

No difference.

---

<div class="post-metadata">

**Author:** ![mattias](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/cab0a1/32.png) [@mattias](https://www.ruby-forum.com/u/mattias)\
**Post date:** [December 13, 2005, 2:56pm UTC](https://www.ruby-forum.com/t/problem-with-save-when-model-has-two-habtm/50129/5 "2005-12-13T14:56:24Z")

</div>

pluralize(2,‘media’)

-\> 2 medias

---

<div class="post-metadata">

**Author:** ![mattias](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/cab0a1/32.png) [@mattias](https://www.ruby-forum.com/u/mattias)\
**Post date:** [December 13, 2005, 3:59pm UTC](https://www.ruby-forum.com/t/problem-with-save-when-model-has-two-habtm/50129/6 "2005-12-13T15:59:01Z")

</div>

Hi Everyone,

Oddly enough I was going to post something similar to this post. Here’s  
my  
situation and here’s what a friend and I have found:

There is a model with 4 HABTM relationships. When ‘create’ is executed  
only  
one HABTM is actually saved; the same one each time. The remaining  
three  
would only be saved in ‘update’.

Last night I found this in the ActiveRecord documents: Adding an object  
to  
a collection  
(has\_many[http://ar.rubyonrails.com/classes/ActiveRecord/Associations/ClassMethods.html#M000011](http://ar.rubyonrails.com/classes/ActiveRecord/Associations/ClassMethods.html#M000011)or  
has\_and\_belongs\_to\_many[http://ar.rubyonrails.com/classes/ActiveRecord/Associations/ClassMethods.html#M000014](http://ar.rubyonrails.com/classes/ActiveRecord/Associations/ClassMethods.html#M000014))  
automatically saves that object, except if the parent object (the owner  
of  
the collection) is not yet stored in the database.

Not ideal, but like Mark Reginald J., we discovered saving the model  
first then changing the associations and saving the model again produced  
the  
desired results.

So I went from ‘Why aren’t the other HABTMs saving?’ to ‘Why is that one  
HABTM saving?’

Has anyone else experienced this situation?

Mel

---

<div class="post-metadata">

**Author:** ![mattias](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/cab0a1/32.png) [@mattias](https://www.ruby-forum.com/u/mattias)\
**Post date:** [December 14, 2005, 12:20am UTC](https://www.ruby-forum.com/t/problem-with-save-when-model-has-two-habtm/50129/7 "2005-12-14T00:20:32Z")

</div>

can someone post a code example of the best method to save the parent  
then do the habtm relations?

thanks from this designer masquerading as a programmer,  
-A

---

<div class="post-metadata">

**Author:** ![mattias](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/cab0a1/32.png) [@mattias](https://www.ruby-forum.com/u/mattias)\
**Post date:** [December 13, 2005, 1:25pm UTC](https://www.ruby-forum.com/t/problem-with-save-when-model-has-two-habtm/50129/8 "2005-12-13T13:25:20Z")

</div>

Anthony Rudgick wrote:

> I have encountered the exact same problem and have yet to find a  
> solution. hopefully someone can figure this quirky behavior out.

Interesting. I’ve also had problem with join table entries not  
being added when the parent object is created. I fixed it by  
adding the related objects after saving the parent object,  
but I was unable to reproduce the problem in some experiments  
with a simple pair of related models. So perhaps there is some  
problem that only manifests in more complex code. I’m using only  
one HABTM, not two however.

–  
We develop, watch us RoR, in numbers too big to ignore.

---

<div class="post-metadata">

**Author:** ![mattias](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/cab0a1/32.png) [@mattias](https://www.ruby-forum.com/u/mattias)\
**Post date:** [December 13, 2005, 4:16pm UTC](https://www.ruby-forum.com/t/problem-with-save-when-model-has-two-habtm/50129/9 "2005-12-13T16:16:36Z")

</div>

Just to clearify - this is also the behavior I see. Have also got it  
working by saving the object twice. This just feels wrong when the first  
HABTM is saved on the first save.

---

<div class="post-metadata">

**Author:** ![mattias](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/cab0a1/32.png) [@mattias](https://www.ruby-forum.com/u/mattias)\
**Post date:** [December 15, 2005, 9:56pm UTC](https://www.ruby-forum.com/t/problem-with-save-when-model-has-two-habtm/50129/10 "2005-12-15T21:56:29Z")

</div>

Yep, just ran into this.

Its always the first HABTM relationship that saves. If I reorder them  
the first one will save, but not the others. Really odd, but just  
confirming this is the current behavior.

> So I went from ‘Why aren’t the other HABTMs saving?’ to ‘Why is that one  
> HABTM saving?’
> 
> Has anyone else experienced this situation?
> 
> Mel

---

<div class="post-metadata">

**Author:** ![mattias](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/cab0a1/32.png) [@mattias](https://www.ruby-forum.com/u/mattias)\
**Post date:** [December 13, 2005, 4:23pm UTC](https://www.ruby-forum.com/t/problem-with-save-when-model-has-two-habtm/50129/11 "2005-12-13T16:23:30Z")

</div>

Just to add to Mel’s comments (I’m working with him):

We could find no logical reason why one of our associations always  
saved and the others never did on a creation of a new owner. For  
example:

f = Foo.new  
f.ass\_1\_ids = [1,2,3]  
f.ass\_2\_ids = [1,2,3]  
f.ass\_3\_ids = [1,2,3]

f.save

ass\_1s always were persisted.  
ass\_2s and ass\_3s never were.

I experimented with the issue in script/console for quite a while  
last night, even switching dbs from Sqlite to MySql and even changing  
our table column names to be totally rails conventional. Nothing  
changed.

Interestingly, one of the associations that always failed on the web  
app worked in the console.

Another datapoint is that the associations were fetched with now  
problems when assigned to the owner (an excerpt from my console):

?\> r = Recipe.new  
=\> #\<Recipe:0x252c94c @attributes={“name”=\>nil,  
“experiment\_type\_id”=\>nil, “replicate\_type\_id”=\>nil,  
“description”=\>nil, “workorder\_id”=\>nil}, @new\_record=true\>

> > r.name = ‘kinase recipe’  
> > =\> “kinase recipe”
> 
> > r.description = ‘description’  
> > =\> “description”

#### assign the kinases:

> > r.kinase\_ids=[1,2,3]  
> > =\> [1, 2, 3]
> 
> > r  
> > =\> #\<Recipe:0x252c94c @attributes={“name”=\>“kinase recipe”,  
> > “experiment\_type\_id”=\>nil, “replicate\_type\_id”=\>nil,  
> > “description”=\>“description”, “workorder\_id”=\>nil}, @new\_record=true,  
> > @kinases=[#\<Kinase:0x251fe2c @attributes=  
> > {“ref\_inhib\_compound\_id”=\>“10”, “name”=\>“c-RAF(h)”,  
> > “active\_f”=\>“17807”, “sort\_order”=\>“1”,  
> > “ref\_inhib\_10atp\_compound\_conc”=\>“10”, “id”=\>“1”, “simple\_name”=\>nil,  
> > “ref\_inhib\_100atp\_compound\_conc”=\>“10”, “description”=\>“45.00000000”,  
> > “catalog\_number”=\>“c-RAF(h)”, “km\_conc”=\>“47.00000000”,  
> > “ref\_inhib\_known\_value”=\>“14”}\>, #\<Kinase:0x251fdf0 @attributes=  
> > {“ref\_inhib\_compound\_id”=\>“1”, “name”=\>“MEK1(h)”,  
> > “active\_f”=\>“17809”, “sort\_order”=\>“1”,  
> > “ref\_inhib\_10atp\_compound\_conc”=\>“1”, “id”=\>“2”, “simple\_name”=\>nil,  
> > “ref\_inhib\_100atp\_compound\_conc”=\>“10”, “description”=\>“10.00000000”,  
> > “catalog\_number”=\>“MEK1(h)”, “km\_conc”=\>“126.00000000”,  
> > “ref\_inhib\_known\_value”=\>“14”}\>, #\<Kinase:0x251fdb4 @attributes=  
> > {“ref\_inhib\_compound\_id”=\>“30”, “name”=\>“MAPK2(m)”,  
> > “active\_f”=\>“17802”, “sort\_order”=\>“1”,  
> > “ref\_inhib\_10atp\_compound\_conc”=\>“30”, “id”=\>“3”, “simple\_name”=\>nil,  
> > “ref\_inhib\_100atp\_compound\_conc”=\>“10”,  
> > “description”=\>“155.00000000”, “catalog\_number”=\>“MAPK2(m)”,  
> > “km\_conc”=\>“122.00000000”, “ref\_inhib\_known\_value”=\>“14”}\>]\>

> > #### the kinases were found!

As Mel said, our solution is to save the owner first, then add the  
associations and save again.

For those who want more data, here’s a longer segment of my console  
output, with one that works and one that doesn’t:

Create a new Recipe:

> > r = Recipe.new  
> > =\> #\<Recipe:0x2586820 @attributes={“name”=\>nil,  
> > “experiment\_type\_id”=\>nil, “replicate\_type\_id”=\>nil,  
> > “description”=\>nil, “workorder\_id”=\>nil}, @new\_record=true\>
> 
> > r.name = ‘foo’  
> > =\> “foo”
> 
> > r.description = ‘bar’  
> > =\> “bar”

Add some atp\_concentrations (many to many)

> > r.atp\_concentration\_ids=[1,2]  
> > =\> [1, 2]
> 
> > r  
> > =\> #\<Recipe:0x2586820 @attributes={“name”=\>“foo”,  
> > “experiment\_type\_id”=\>nil, “replicate\_type\_id”=\>nil,  
> > “description”=\>“bar”, “workorder\_id”=\>nil}, @atp\_concentrations=  
> > [#\<AtpConcentration:0x254c490 @attributes={“id”=\>“1”,  
> > “description”=\>“KM”}\>, #\<AtpConcentration:0x254c454 @attributes=  
> > {“id”=\>“2”, “description”=\>“10”}\>], @new\_record=true\>
> 
> > r.save  
> > =\> true
> 
> > r.id  
> > =\> 15
> 
> > r = Recipe.find 15  
> > =\> #\<Recipe:0x25377c0 @attributes={“name”=\>“foo”,  
> > “experiment\_type\_id”=\>nil, “replicate\_type\_id”=\>nil, “id”=\>“15”,  
> > “description”=\>“bar”, “workorder\_id”=\>nil}\>
> 
> > r  
> > =\> #\<Recipe:0x25377c0 @attributes={“name”=\>“foo”,  
> > “experiment\_type\_id”=\>nil, “replicate\_type\_id”=\>nil, “id”=\>“15”,  
> > “description”=\>“bar”, “workorder\_id”=\>nil}\>
> 
> > r.atp\_concentrations  
> > =\> [#\<AtpConcentration:0x252fd2c @attributes=  
> > {“atp\_concentration\_id”=\>“1”, “recipe\_id”=\>“15”, “id”=\>“1”,  
> > “description”=\>“KM”}\>, #\<AtpConcentration:0x252fcf0 @attributes=  
> > {“atp\_concentration\_id”=\>“2”, “recipe\_id”=\>“15”, “id”=\>“2”,  
> > “description”=\>“10”}\>]
> 
> > #### atp\_concentrations worked fine on a Recipe.new… r.save

?\> #### now for a kinase:  
?\> r = Recipe.new  
=\> #\<Recipe:0x252c94c @attributes={“name”=\>nil,  
“experiment\_type\_id”=\>nil, “replicate\_type\_id”=\>nil,  
“description”=\>nil, “workorder\_id”=\>nil}, @new\_record=true\>

> > r.name = ‘kinase recipe’  
> > =\> “kinase recipe”
> 
> > r.description = ‘description’  
> > =\> “description”
> 
> > r.kinase\_ids=[1,2,3]  
> > =\> [1, 2, 3]
> 
> > r  
> > =\> #\<Recipe:0x252c94c @attributes={“name”=\>“kinase recipe”,  
> > “experiment\_type\_id”=\>nil, “replicate\_type\_id”=\>nil,  
> > “description”=\>“description”, “workorder\_id”=\>nil}, @new\_record=true,  
> > @kinases=[#\<Kinase:0x251fe2c @attributes=  
> > {“ref\_inhib\_compound\_id”=\>“10”, “name”=\>“c-RAF(h)”,  
> > “active\_f”=\>“17807”, “sort\_order”=\>“1”,  
> > “ref\_inhib\_10atp\_compound\_conc”=\>“10”, “id”=\>“1”, “simple\_name”=\>nil,  
> > “ref\_inhib\_100atp\_compound\_conc”=\>“10”, “description”=\>“45.00000000”,  
> > “catalog\_number”=\>“c-RAF(h)”, “km\_conc”=\>“47.00000000”,  
> > “ref\_inhib\_known\_value”=\>“14”}\>, #\<Kinase:0x251fdf0 @attributes=  
> > {“ref\_inhib\_compound\_id”=\>“1”, “name”=\>“MEK1(h)”,  
> > “active\_f”=\>“17809”, “sort\_order”=\>“1”,  
> > “ref\_inhib\_10atp\_compound\_conc”=\>“1”, “id”=\>“2”, “simple\_name”=\>nil,  
> > “ref\_inhib\_100atp\_compound\_conc”=\>“10”, “description”=\>“10.00000000”,  
> > “catalog\_number”=\>“MEK1(h)”, “km\_conc”=\>“126.00000000”,  
> > “ref\_inhib\_known\_value”=\>“14”}\>, #\<Kinase:0x251fdb4 @attributes=  
> > {“ref\_inhib\_compound\_id”=\>“30”, “name”=\>“MAPK2(m)”,  
> > “active\_f”=\>“17802”, “sort\_order”=\>“1”,  
> > “ref\_inhib\_10atp\_compound\_conc”=\>“30”, “id”=\>“3”, “simple\_name”=\>nil,  
> > “ref\_inhib\_100atp\_compound\_conc”=\>“10”,  
> > “description”=\>“155.00000000”, “catalog\_number”=\>“MAPK2(m)”,  
> > “km\_conc”=\>“122.00000000”, “ref\_inhib\_known\_value”=\>“14”}\>]\>
> 
> > #### the kinases were found!

?\> r.save!  
=\> true

> > #### now let’s refetch the data

?\> r.id  
=\> 16

> > r = Recipe.find 16  
> > =\> #\<Recipe:0x250d830 @attributes={“name”=\>“kinase recipe”,  
> > “experiment\_type\_id”=\>nil, “replicate\_type\_id”=\>nil, “id”=\>“16”,  
> > “description”=\>“description”, “workorder\_id”=\>nil}\>
> 
> > r.kinases  
> > =\> []
> 
> > #### they were not saved

?\> #### but if I add them to this object and do an update, they will  
?\> r.kinase\_ids=[1,2,3]  
=\> [1, 2, 3]

> > r  
> > =\> #\<Recipe:0x250d830 @attributes={“name”=\>“kinase recipe”,  
> > “experiment\_type\_id”=\>nil, “replicate\_type\_id”=\>nil, “id”=\>“16”,  
> > “description”=\>“description”, “workorder\_id”=\>nil}, @kinases=  
> > [#\<Kinase:0x2503010 @attributes={“ref\_inhib\_compound\_id”=\>“10”,  
> > “name”=\>“c-RAF(h)”, “active\_f”=\>“17807”, “sort\_order”=\>“1”,  
> > “ref\_inhib\_10atp\_compound\_conc”=\>“10”, “id”=\>“1”, “simple\_name”=\>nil,  
> > “ref\_inhib\_100atp\_compound\_conc”=\>“10”, “description”=\>“45.00000000”,  
> > “catalog\_number”=\>“c-RAF(h)”, “km\_conc”=\>“47.00000000”,  
> > “ref\_inhib\_known\_value”=\>“14”}\>, #\<Kinase:0x2502fd4 @attributes=  
> > {“ref\_inhib\_compound\_id”=\>“1”, “name”=\>“MEK1(h)”,  
> > “active\_f”=\>“17809”, “sort\_order”=\>“1”,  
> > “ref\_inhib\_10atp\_compound\_conc”=\>“1”, “id”=\>“2”, “simple\_name”=\>nil,  
> > “ref\_inhib\_100atp\_compound\_conc”=\>“10”, “description”=\>“10.00000000”,  
> > “catalog\_number”=\>“MEK1(h)”, “km\_conc”=\>“126.00000000”,  
> > “ref\_inhib\_known\_value”=\>“14”}\>, #\<Kinase:0x2502f98 @attributes=  
> > {“ref\_inhib\_compound\_id”=\>“30”, “name”=\>“MAPK2(m)”,  
> > “active\_f”=\>“17802”, “sort\_order”=\>“1”,  
> > “ref\_inhib\_10atp\_compound\_conc”=\>“30”, “id”=\>“3”, “simple\_name”=\>nil,  
> > “ref\_inhib\_100atp\_compound\_conc”=\>“10”,  
> > “description”=\>“155.00000000”, “catalog\_number”=\>“MAPK2(m)”,  
> > “km\_conc”=\>“122.00000000”, “ref\_inhib\_known\_value”=\>“14”}\>]\>
> 
> > r.save  
> > =\> true
> 
> > r.id  
> > =\> 16
> 
> > r = Recipe.find 16  
> > =\> #\<Recipe:0x24ef90c @attributes={“name”=\>“kinase recipe”,  
> > “experiment\_type\_id”=\>nil, “replicate\_type\_id”=\>nil, “id”=\>“16”,  
> > “description”=\>“description”, “workorder\_id”=\>nil}\>
> 
> > r.kinases  
> > =\> [#\<Kinase:0x24eb0dc @attributes={“ref\_inhib\_compound\_id”=\>“10”,  
> > “name”=\>“c-RAF(h)”, “active\_f”=\>“17807”, “sort\_order”=\>“1”,  
> > “kinase\_id”=\>“1”, “recipe\_id”=\>“16”,  
> > “ref\_inhib\_10atp\_compound\_conc”=\>“10”, “id”=\>“1”, “simple\_name”=\>nil,  
> > “ref\_inhib\_100atp\_compound\_conc”=\>“10”, “description”=\>“45.00000000”,  
> > “catalog\_number”=\>“c-RAF(h)”, “km\_conc”=\>“47.00000000”,  
> > “ref\_inhib\_known\_value”=\>“14”}\>, #\<Kinase:0x24eb0a0 @attributes=  
> > {“ref\_inhib\_compound\_id”=\>“1”, “name”=\>“MEK1(h)”,  
> > “active\_f”=\>“17809”, “sort\_order”=\>“1”, “kinase\_id”=\>“2”,  
> > “recipe\_id”=\>“16”, “ref\_inhib\_10atp\_compound\_conc”=\>“1”, “id”=\>“2”,  
> > “simple\_name”=\>nil, “ref\_inhib\_100atp\_compound\_conc”=\>“10”,  
> > “description”=\>“10.00000000”, “catalog\_number”=\>“MEK1(h)”,  
> > “km\_conc”=\>“126.00000000”, “ref\_inhib\_known\_value”=\>“14”}\>, #\<Kinase:  
> > 0x24eb064 @attributes={“ref\_inhib\_compound\_id”=\>“30”, “name”=\>“MAPK2  
> > (m)”, “active\_f”=\>“17802”, “sort\_order”=\>“1”, “kinase\_id”=\>“3”,  
> > “recipe\_id”=\>“16”, “ref\_inhib\_10atp\_compound\_conc”=\>“30”, “id”=\>“3”,  
> > “simple\_name”=\>nil, “ref\_inhib\_100atp\_compound\_conc”=\>“10”,  
> > “description”=\>“155.00000000”, “catalog\_number”=\>“MAPK2(m)”,  
> > “km\_conc”=\>“122.00000000”, “ref\_inhib\_known\_value”=\>“14”}\>]
> 
> >

---

<div class="post-metadata">

**Author:** ![mattias](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/cab0a1/32.png) [@mattias](https://www.ruby-forum.com/u/mattias)\
**Post date:** [December 14, 2005, 1:55am UTC](https://www.ruby-forum.com/t/problem-with-save-when-model-has-two-habtm/50129/12 "2005-12-14T01:55:34Z")

</div>

Mel put this in our code base earlier. I’ve abbreviated the final save:

@recipe = Recipe.new(params[:recipe])  
@recipe.save!

# Ruby has a simple definition of truth. Any value that is not nil or

the constant false is true.

# update any associations defined:

@recipe.kinase\_ids = @params[:kinase\_ids] == nil ? Array.new : @params  
[:kinase\_ids]  
removed\_email\_address@domain.invalid  
#go where you want  
else  
#go where you want  
end
