Andrey Drozdov Andrey Drozdov - 14 days ago 5
Ruby Question

Ruby/Rails: Use `separator: '-'` instead

Writing test for my project, and notice this warning it terminal when running rspec

DEPRECATION WARNING: Passing the separator argument as a positional
parameter is deprecated and will soon be removed.
Use `separator: '-'` instead.
(called from add_link at /myapp/app/models/post.rb:37)


I have an action before save record, looks like

self.link = theme + '-' + Time.now.to_formatted_s(:number)


And I've tried to find some information about this but I don't really don't understanding what this warning means.

** EDIT **

Well, I've changed for
"#{theme}-#{Time.now.to_formatted_s(:number)}"
but it still gives me the same warning.

Than I decided to go other way and changed for
"#{theme}(#{date})"
. The
date
method look like:

date = [Time.now.day, Time.now.month, Time.now.year]
date = date.join('-')
date


But it still gives me an error.

I don't think it's really big problem, but still I want t figure out why is that happening.

** EDIT **

Figure it out, it must gem that I use cause that problem (the gem is called
the_string_to_slug
) I will do future research to fix this warning with gem or I'll try to find way to replace it.

Answer

This deprecation was removed 10 days ago. https://github.com/rails/rails/commit/0189f4db6fe518de8909b66b7f30046bac52dedc

Probably one of gems use old format of parameterize method.