Rails, How can I combine multiple model attributes to create a unique permalink using permalink_fu?

Posted by Ranknoodle on Stack Overflow See other posts from Stack Overflow or by Ranknoodle
Published on 2010-04-10T22:38:39Z Indexed on 2010/04/10 22:43 UTC
Read the original article Hit count: 292

Can Permalink_fu combine 2 or more model attributes to create a unique permalink?

Let's say I have a Business Model, this model contains :name, :address, :phone, :city, :state, :country etc. attributes.

Right now I have permalink set up in this model only for :name

has_permalink :name

So I would get "/biz/name". However I would like to combine the Business name, city, and a incremental number if there are more than 1 location in the city for that business.

For example I would like to use:

"/biz/joes-coffee-shack-chicago" for the permalink

or if a multple location business

"/biz/starbucks-chicago-92"

Is this possible with the current permalink_fu plugin or some fork of permalink_fu? Or will this require some modification to the permalink_fu plugin?

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about permalink-fu