mysql key too long error

I'm using the acts as taggable on plugin, and in the migrations
there's a line of code to create an index:

add_index :taggings, [:taggable_id, :taggable_type, :context], :name
=> "tagging_index", :limit => {:name => 10, :surname => 20}

When I use unicode, the migration fails and I get told that the index
is too long and can only be 1000 bytes. I switched over to ascii to
see if I get the same problem and I didn't. I really want to use
unicode, so I want to get this working.

I'm running Rails 3.0.7 with MySQL 5.1.

I'm using the acts as taggable on plugin, and in the migrations
there's a line of code to create an index:

add_index :taggings, [:taggable_id, :taggable_type, :context], :name
=> "tagging_index", :limit => {:name => 10, :surname => 20}

When I use unicode, the migration fails and I get told that the index
is too long and can only be 1000 bytes. I switched over to ascii to
see if I get the same problem and I didn't. I really want to use
unicode, so I want to get this working.

If you want to limit the length of the prefix used for indexes, you'll
need to change name/surname up there for the string columns you want
to index (ie taggable_type and context) and change the numbers as
appropriate to your data

Fred

How can I use the :limit to change taggable_ type and context?

How can I use the :limit to change taggable_ type and context?

The limit tells mysql how much of the column to use for the index.
Pick values such that your total index length falls within the limit
(you're probably better off picking a smaller value for taggable_type,
you're very unlikely to have massively long values in that column)

Fred

Oh, I was looking for an example of how to use it like a piece of code
or something.

Nevermind, I got it. I just have to test to see if it works. Thanks
for your help!