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

Setting slug_limit in initialiser crashes rspec tests #992

Open
ConfusedVorlon opened this issue May 15, 2022 · 3 comments
Open

Setting slug_limit in initialiser crashes rspec tests #992

ConfusedVorlon opened this issue May 15, 2022 · 3 comments
Labels

Comments

@ConfusedVorlon
Copy link

ConfusedVorlon commented May 15, 2022

uncommenting in the initialiser:

config.slug_limit = 255

immediately throws an error when any rspec test is run

friendly_id (5.4.2)
rails 7.0.2

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'


this is a dupe of #982 because I couldn't see a way to remove the stale label

@ConfusedVorlon
Copy link
Author

setting slug_limit directly in the model works without an issue

initialiser is as generated by friendly_id

@stale
Copy link

stale bot commented Nov 13, 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 Nov 13, 2022
@ConfusedVorlon
Copy link
Author

Bump

@parndt parndt added pinned and removed stale labels Nov 15, 2022
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

2 participants