Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uncommenting config.slug_limit causes crash #982

Closed
ConfusedVorlon opened this issue Oct 24, 2021 · 2 comments
Closed

uncommenting config.slug_limit causes crash #982

ConfusedVorlon opened this issue Oct 24, 2021 · 2 comments
Labels

Comments

@ConfusedVorlon
Copy link

uncommenting in the initialiser:

config.slug_limit = 255

immediately throws the error:

undefined method `slug_limit=' for #<#<Class:0x00007fd3d4c61e98>:0x00007fd3d4c61d58 @base=nil, @model_class=App(id: integer, name: string, identifier: string, created_at: datetime, updated_at: datetime, slug: string, account_id: integer), @defaults={}, @modules=[], @finder_methods=FriendlyId::FinderMethods, @routes=:friendly, @reserved_words=["new", "edit", "index", "session", "login", "logout", "users", "admin", "stylesheets", "assets", "javascripts", "images"]>

I'm on Rails 6.1.4

trace:

config/initializers/friendly_id.rb:63:in `block in <main>'
friendly_id (5.4.2) lib/friendly_id.rb:85:in `block in extended'
friendly_id (5.4.2) lib/friendly_id.rb:82:in `class_eval'
friendly_id (5.4.2) lib/friendly_id.rb:82:in `extended'
app/models/app.rb:20:in `extend'
app/models/app.rb:20:in `<class:App>'
app/models/app.rb:19:in `<main>'
bootsnap (1.9.1) lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
bootsnap (1.9.1) lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'

there is a github issue on a similar note which suggests just limiting on a per app basis
(which does work)
https://stackoverflow.com/questions/66036641/undefined-method-slug-limit-for-friendly-id

@stale
Copy link

stale bot commented Apr 16, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Apr 16, 2022
@stale stale bot closed this as completed Apr 28, 2022
@ConfusedVorlon
Copy link
Author

still true in

friendly_id (5.4.2)
rails 7.0.2

notably - the rails app runs, but any test run through rspec breaks

An error occurred while loading ./spec/models/meditation_hls_spec.rb.
Failure/Error: extend FriendlyId

NoMethodError:
  undefined method `slug_limit=' for #<#<Class:0x000000016e1f7790>:0x000000016e1f7718 @base=nil, @model_class=Meditation(id: integer, slug: string, title: string, description: text, duration: integer, published: boolean, account_id: integer, created_at: datetime, updated_at: datetime, time_of_day: integer, brain_state: integer, guide_id: integer, artist_id: integer, hls_transcode_id: integer), @defaults={}, @modules=[], @finder_methods=FriendlyId::FinderMethods, @routes=:friendly, @reserved_words=["new", "edit", "index", "session", "login", "logout", "users", "admin", "stylesheets", "assets", "javascripts", "images"]>

    config.slug_limit = 25
          ^^^^^^^^^^^^^
# ./config/initializers/friendly_id.rb:63:in `block in <main>'
# /Users/rob/.rvm/gems/ruby-3.1.2/gems/friendly_id-5.4.2/lib/friendly_id.rb:85:in `block in extended'
# /Users/rob/.rvm/gems/ruby-3.1.2/gems/friendly_id-5.4.2/lib/friendly_id.rb:82:in `class_eval'
# /Users/rob/.rvm/gems/ruby-3.1.2/gems/friendly_id-5.4.2/lib/friendly_id.rb:82:in `extended'
# ./app/models/meditation.rb:48:in `extend'
# ./app/models/meditation.rb:48:in `<class:Meditation>'
# ./app/models/meditation.rb:36:in `<main>'
# /Users/rob/.rvm/gems/ruby-3.1.2/gems/bootsnap-1.10.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
# /Users/rob/.rvm/gems/ruby-3.1.2/gems/bootsnap-1.10.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
# /Users/rob/.rvm/gems/ruby-3.1.2/gems/zeitwerk-2.5.4/lib/zeitwerk/kernel.rb:27:in `require'
# ./spec/models/meditation_hls_spec.rb:38:in `<main>'
# /Users/rob/.rvm/gems/ruby-3.1.2/gems/bootsnap-1.10.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:48:in `load'
# /Users/rob/.rvm/gems/ruby-3.1.2/gems/bootsnap-1.10.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:48:in `load'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant