ruby-on-railsrubyfriendly-id

undefined method `slug_limit=' for friendly_id


When I set the slug_limit on friendly_id as per the documentation in the initializer, I see the following error:

Failure/Error: extend FriendlyId

NoMethodError:
  undefined method `slug_limit=' for #<#<Class:0x00007ffe66dd01a0>:0x00007ffe66dd0150>
# ./config/initializers/friendly_id.rb:68:in `block in <top (required)>'

My model implements friendly_id like this:

extend FriendlyId
friendly_id :title, use: [:slugged, :finders]

How do I set the slug limit?


Solution

  • You could try to set slug_limit like this from the test example:

    extend FriendlyId
    friendly_id :title, use: :slugged, slug_limit: 40