# Multiple select issue with a HABTM relationship using Rails 4

**URL:** <https://www.ruby-forum.com/t/multiple-select-issue-with-a-habtm-relationship-using-rails-4/235861>\
**Category:** Rails\
**Created:** [July 20, 2013, 1:01pm UTC](https://www.ruby-forum.com/t/multiple-select-issue-with-a-habtm-relationship-using-rails-4/235861 "2013-07-20T13:01:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![addis\_a](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c4cdca/32.png) [@addis\_a](https://www.ruby-forum.com/u/addis_a)\
**Post date:** [July 20, 2013, 1:01pm UTC](https://www.ruby-forum.com/t/multiple-select-issue-with-a-habtm-relationship-using-rails-4/235861/1 "2013-07-20T13:01:44Z")

</div>

Although the code seems to be right, when I try to send the form, the  
values of the multiple select aren’t being sent.If I just remove the  
multiple option, everything works as expected considering just one  
value,  
but it’s important to store more than one tag per transaction.

Do you have any ideas about what could be happening here?

_Model_

_Transaction.rb_

class Transaction \< ActiveRecord::Base  
has\_and\_belongs\_to\_many :tags

_Tag.rb_

class tag \< ActiveRecord::Base  
has\_and\_belongs\_to\_many :transactions

_View_

\<%= form.collection\_select :tag\_ids, @tags, :id, :name, {},  
{:multiple =\> true} %\>

_Result:_

…

---

<div class="post-metadata">

**Author:** ![dcaseres](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/a87d85/32.png) [@dcaseres](https://www.ruby-forum.com/u/dcaseres)\
**Post date:** [July 20, 2013, 4:28pm UTC](https://www.ruby-forum.com/t/multiple-select-issue-with-a-habtm-relationship-using-rails-4/235861/2 "2013-07-20T16:28:31Z")

</div>

On Fri, Jul 19, 2013 at 5:52 AM, Diego C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> Although the code seems to be right, when I try to send the form, the values  
> of the multiple select aren’t being sent.

Are you sure about that? Check the log output from submitting the  
form.

–  
Hassan S. ------------------------ [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
[Hassan Schroeder | about.me](http://about.me/hassanschroeder)  
twitter: @hassan
