Rails 3.1 cached_slug column not being updated?
When creating a record that uses friendly_id, it adds the necessary records into the slugs table, but does not update the cached_slug column in the relevant table.
For example, my model looks like:
class Genre < ActiveRecord::Base
has_friendly_id :name, :use_slug => true
...
end
In console, I do:
Genre.create(:name => 'Acoustic')
Slugs table is updated. The genre 'Acoustic' is created in the Genre table. But the cached_slug column in the Genre table is NULL. I am using mysql and the mysql2 gem.
This used to work with Rails 3.0.X, but not with 3.1RC. Is this a known issue? Any solutions?
Can you send me a minimal Rails app that shows this behavior, or add a failing test case to FriendlyId? If this is indeed a bug I can solve it more quickly if I can reproduce it.
Hmmm on further tests. It seems to work now. Strange...
I had this problem, too, and resolved it like this spraints@156af1d54b86d945e073a53442724844e1a81e04
Same problem here, @spraints could you do a pull request with your patch ?
I can confirm that my Rails 3.1 project never updates its cached slugs with friendly_id 3.2.1. When I use spraints' fork my cached slugs work.
spraints@156af1d fixes the cached_slug being empty in Rails 3.1 for me as well.