# Add\_index fails for composite index

**URL:** <https://www.ruby-forum.com/t/add-index-fails-for-composite-index/175227>\
**Category:** Rails\
**Created:** [September 9, 2009, 11:44pm UTC](https://www.ruby-forum.com/t/add-index-fails-for-composite-index/175227 "2009-09-09T23:44:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gokul\_Janga](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/e9bcb4/32.png) [@Gokul\_Janga](https://www.ruby-forum.com/u/Gokul_Janga)\
**Post date:** [September 9, 2009, 11:44pm UTC](https://www.ruby-forum.com/t/add-index-fails-for-composite-index/175227/1 "2009-09-09T23:44:54Z")

</div>

Anyone encountering an error with add\_index and multiple columns?

For example -

add\_index(:article\_views, [:session\_id,:ip\_address], :unique =\>  
true, :name =\> ‘article\_views\_unique’)

in a migration throws the following error -

“wrong number of arguments (1 for 0)”

but the following works fine !!

add\_index(:article\_views, [:session\_id], :unique =\> true, :name =\>  
‘article\_views\_unique’)

The documentation says that the column name that follows the table  
name can be an array of symbols, but it seems to accept only one  
entry.

Using Rails 2.3.2 against PostgreSQL using the Pg 0.8.0 driver.

Thanks for any help.  
Gokul.

---

<div class="post-metadata">

**Author:** ![Gokul\_Janga](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/e9bcb4/32.png) [@Gokul\_Janga](https://www.ruby-forum.com/u/Gokul_Janga)\
**Post date:** [September 10, 2009, 9:05am UTC](https://www.ruby-forum.com/t/add-index-fails-for-composite-index/175227/2 "2009-09-10T09:05:42Z")

</div>

Found the problem !!  
I had to uninstall the Less gem (less-1.1.12) .

rake db:migration --trace gave me the following stack -

wrong number of arguments (1 for 0)  
/usr/lib/ruby/gems/1.8/gems/less-1.1.12/lib/ext.rb:60:in `inspect' /usr/lib/ruby/gems/1.8/gems/less-1.1.12/lib/ext.rb:60:in`send’  
/usr/lib/ruby/gems/1.8/gems/less-1.1.12/lib/ext.rb:60:in `to_proc' /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/ migration.rb:346:in`map’  
/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active\_record/  
migration.rb:346:in `method\_missing’  
…rest deleted…
