ruby on rails - friendly_id and new records -
I am using friendly_id 4.0.0.beta8 and want to generate url which uses slug, but Still the model is id It seems that friendly_id first generates slugs before_validation However, at this time (before saving) there is definitely no Model ID available and so creates friendly ID without slug.
How can I ensure that the new records will be slashed with the ID after initial saving?
I'm the author of Frugal ID.
tries to solve the problem that exists on the text ID without numeric ID with the Friend ID. So if you're just getting model ID in the lattice, then you probably do not use FriendlyId to avoid that extra complexity and that model; You may only be able to override the toparor:
def to_param "# {id} - {title.parameterize}" end
Comments
Post a Comment