Forum: Ruby on Rails friendly_id / acts_as_referenced conflict?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
37458f666d90dc342c3dc45cb64d96ff?d=identicon&s=25 n0d dy (noddy)
on 2009-02-19 12:58
Hi,

I'm using acts_as_referenced to generate unique references:

# property.rb
class Property < ActiveRecord::Base
 acts_as_referenced :referenced_column => "permalink"
end

I would now like to use friendly_id to create seo friendly URLs instead
of using the id.

I now have:

# property.rb
class Property < ActiveRecord::Base
 acts_as_referenced :referenced_column => "permalink"
 has_friendly_id :permalink, :use_slug => true
end

The above code generates a "slug text is blank" error - I assume this is
due to acts_as_referenced using a before_save callback to generate the
permalink which friendly_id is looking for.

Is it possible to get the two plugins working together? Initialize the
acts_as_referenced first?
This topic is locked and can not be replied to.