Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8048731
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T06:34:15+00:00 2026-06-05T06:34:15+00:00

Trying to get my app running the FriendlyId gem (version 4.0.1) I think I’m

  • 0

Trying to get my app running the FriendlyId gem (version 4.0.1)

I think I’m doing this in the wrong order, but I want to strip out apostrophes before my friendly_id slug is generated when creating a new record. But I think the method normalize_friend_id is being called after the id is already generated.

I’ve added the following to my model:

class Team < ActiveRecord::Base
  extend FriendlyId
  friendly_id :name, :use => :slugged

  def normalize_friendly_id(string)
    super.gsub("\'", "")
  end

end
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T06:34:17+00:00Added an answer on June 5, 2026 at 6:34 am

    super calls the superclass first, meaning the friendly id is being generated then you’re running gsub on THAT result. What you really want is to override this method completely.

    Refer to: https://github.com/norman/friendly_id/blob/master/lib/friendly_id/slugged.rb#L244-246

    your code should look like this:

    def normalize_friendly_id(string)
      string.to_s.gsub("\'", "").parameterize
    end
    

    or

    def normalize_friendly_id(string)
      super(string.to_s.gsub("\'", ""))
    end
    

    Hope that helps

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm so stuck with trying to get a simple NHibernate app running. I'm doing
I'm currently trying to get a Facebook App up and running. But I get
I am trying to get my rails app to production but this is my
I'm trying to get the hello world app running from the doc . I
I'm trying to get my app to change layouts when the orientation changes. This
Im trying to get started with app development. Isnt this the corrent JDK if
I am trying to get a Django app running on Apache with mod_wsgi. I
I am trying to get my app up and running on heroku. However once
I've been trying to get this to work all afternoon and can't. I want
I'm trying to get someone else's app up and running on my development laptop

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.