Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

DEPRECATION WARNING: Using a 'Essence#{type}' content is deprecated. Please use a '#{type}' instead #2405

Closed
chiperific opened this issue Dec 22, 2022 · 10 comments

Comments

@chiperific
Copy link
Contributor

  • Alchemy Version: 6.0.12
  • Rails Version: 6.1.7

Here's a small sample of my server log:

DEPRECATION WARNING: Using a 'EssenceText' content is deprecated. Please use a 'Text' ingredient instead. (called from block (2 levels) in _app_views_alchemy_elements__hero_html_haml__11520142127363993_46000 at /Users/ckragt/ruby/genoneparenting/app/views/alchemy/elements/_hero.html.haml:62)
DEPRECATION WARNING: Using a 'EssenceRichtext' content is deprecated. Please use a 'Richtext' ingredient instead. (called from block (2 levels) in _app_views_alchemy_elements__hero_html_haml__11520142127363993_46000 at /Users/ckragt/ruby/genoneparenting/app/views/alchemy/elements/_hero.html.haml:63)
DEPRECATION WARNING: Using a 'EssencePicture' content is deprecated. Please use a 'Picture' ingredient instead. (called from block (3 levels) in _app_views_alchemy_elements__three_column_gallery_html_haml___3496305864658709818_46100 at /Users/ckragt/ruby/genoneparenting/app/views/alchemy/elements/_three_column_gallery.html.haml:16)
DEPRECATION WARNING: Using a 'EssenceSelect' content is deprecated. Please use a 'Select' ingredient instead. (called from block (2 levels) in _app_views_alchemy_elements__button_html_haml___2089347646595429945_46140 at /Users/ckragt/ruby/genoneparenting/app/views/alchemy/elements/_button.html.haml:12)
DEPRECATION WARNING: available is deprecated and will be removed from Alchemy 6.1 (use published instead) (called from block in available at /Users/ckragt/.rvm/gems/ruby-3.1.3@genoneparenting/gems/activerecord-6.1.7/lib/active_record/relation/delegation.rb:67)
DEPRECATION WARNING: available is deprecated and will be removed from Alchemy 6.1 (use published instead) (called from block in available at /Users/ckragt/.rvm/gems/ruby-3.1.3@genoneparenting/gems/activerecord-6.1.7/lib/active_record/relation/delegation.rb:67)
DEPRECATION WARNING: Using a 'EssenceRichtext' content is deprecated. Please use a 'Richtext' ingredient instead. (called from block (2 levels) in _app_views_alchemy_elements__review_html_haml___2279482769069987844_46200 at /Users/ckragt/ruby/genoneparenting/app/views/alchemy/elements/_review.html.haml:11)
DEPRECATION WARNING: Using a 'EssenceText' content is deprecated. Please use a 'Text' ingredient instead. (called from block (2 levels) in _app_views_alchemy_elements__review_html_haml___2279482769069987844_46200 at /Users/ckragt/ruby/genoneparenting/app/views/alchemy/elements/_review.html.haml:13)
DEPRECATION WARNING: Using a 'EssenceRichtext' content is deprecated. Please use a 'Richtext' ingredient instead. (called from block (2 levels) in _app_views_alchemy_elements__review_html_haml___2279482769069987844_46200 at /Users/ckragt/ruby/genoneparenting/app/views/alchemy/elements/_review.html.haml:11)
DEPRECATION WARNING: Using a 'EssenceText' content is deprecated. Please use a 'Text' ingredient instead. (called from block (2 levels) in _app_views_alchemy_elements__review_html_haml___2279482769069987844_46200 at /Users/ckragt/ruby/genoneparenting/app/views/alchemy/elements/_review.html.haml:13)
DEPRECATION WARNING: Using a 'EssenceRichtext' content is deprecated. Please use a 'Richtext' ingredient instead. (called from block (2 levels) in _app_views_alchemy_elements__review_html_haml___2279482769069987844_46200 at /Users/ckragt/ruby/genoneparenting/app/views/alchemy/elements/_review.html.haml:11)
DEPRECATION WARNING: Using a 'EssenceText' content is deprecated. Please use a 'Text' ingredient instead. (called from block (2 levels) in _app_views_alchemy_elements__review_html_haml___2279482769069987844_46200 at /Users/ckragt/ruby/genoneparenting/app/views/alchemy/elements/_review.html.haml:13)
DEPRECATION WARNING: Using a 'EssencePicture' content is deprecated. Please use a 'Picture' ingredient instead. (called from block (3 levels) in _app_views_alchemy_elements__header_html_haml__443379875146908904_46300 at /Users/ckragt/ruby/genoneparenting/app/views/alchemy/elements/_header.html.haml:6)
DEPRECATION WARNING: Using a 'EssenceText' content is deprecated. Please use a 'Text' ingredient instead. (called from block (2 levels) in _app_views_alchemy_elements__icon_link_html_haml___4072561704295074464_46500 at /Users/ckragt/ruby/genoneparenting/app/views/alchemy/elements/_icon_link.html.haml:4)
DEPRECATION WARNING: Using a 'EssenceText' content is deprecated. Please use a 'Text' ingredient instead. (called from block (2 levels) in _app_views_alchemy_elements__icon_link_html_haml___4072561704295074464_46500 at /Users/ckragt/ruby/genoneparenting/app/views/alchemy/elements/_icon_link.html.haml:4)
DEPRECATION WARNING: Using a 'EssenceText' content is deprecated. Please use a 'Text' ingredient instead. (called from block (3 levels) in _app_views_alchemy_elements__icon_link_html_haml___4072561704295074464_46500 at /Users/ckragt/ruby/genoneparenting/app/views/alchemy/elements/_icon_link.html.haml:5)
DEPRECATION WARNING: Using a 'EssenceText' content is deprecated. Please use a 'Text' ingredient instead. (called from block (2 levels) in _app_views_alchemy_elements__icon_link_html_haml___4072561704295074464_46500 at /Users/ckragt/ruby/genoneparenting/app/views/alchemy/elements/_icon_link.html.haml:4)
DEPRECATION WARNING: Using a 'EssenceText' content is deprecated. Please use a 'Text' ingredient instead. (called from block (2 levels) in _app_views_alchemy_elements__icon_link_html_haml___4072561704295074464_46500 at /Users/ckragt/ruby/genoneparenting/app/views/alchemy/elements/_icon_link.html.haml:4)
DEPRECATION WARNING: Using a 'EssenceText' content is deprecated. Please use a 'Text' ingredient instead. (called from block (3 levels) in _app_views_alchemy_elements__icon_link_html_haml___4072561704295074464_46500 at /Users/ckragt/ruby/genoneparenting/app/views/alchemy/elements/_icon_link.html.haml:5)
DEPRECATION WARNING: Using a 'EssencePicture' content is deprecated. Please use a 'Picture' ingredient instead. (called from block (3 levels) in _app_views_alchemy_elements__footer_html_haml___2118567664489782134_46540 at /Users/ckragt/ruby/genoneparenting/app/views/alchemy/elements/_footer.html.haml:6)
DEPRECATION WARNING: Using a 'EssenceText' content is deprecated. Please use a 'Text' ingredient instead. (called from block (2 levels) in _app_views_alchemy_elements__footer_html_haml___2118567664489782134_46540 at /Users/ckragt/ruby/genoneparenting/app/views/alchemy/elements/_footer.html.haml:12)

Not only do these a totally pollute my logs, The suggested fix doesn't exist yet. The schema is all Essence#{type} tables.

I see Alchemy::Deprecation.silence but it takes a block and I don't want to pass my entire app into that block.

What's my recommended fix here?

@tvdeyen
Copy link
Member

tvdeyen commented Dec 22, 2022

The suggested fix doesn't exist yet

Have you tried using

- name: icon_link
  ingredients:
    - name: some-thing
      type: Text

instead of

- name: icon_link
  contents:
    - name: some-thing
      type: EssenceText

in your elements.yml?

The schema is all Essence#{type} tables

We still support both, but ingredients is the future. Hence the deprecation warnings.

@chiperific
Copy link
Contributor Author

chiperific commented Dec 22, 2022

When I try switching from Essence#{type} to #{Type} in elements.yml I get strange errors in the Admin interface.

Things like

uninitialized constant Alchemy::Text
candidate = constant.const_get(name)
                    ^^^^^^^^^^
uninitialized constant Alchemy::Richtext

            candidate = constant.const_get(name)
                                ^^^^^^^^^^

And I can't access those classes myself in a console either.

@tvdeyen
Copy link
Member

tvdeyen commented Dec 22, 2022

The classes are all namespaced to Alchemy::Ingredients see https://github.com/AlchemyCMS/alchemy_cms/tree/main/app/models/alchemy/ingredients

You need to run a task to convert the existing elements to ingredients:

bin/rake alchemy:upgrade:6.0:create_ingredients

@chiperific
Copy link
Contributor Author

Is there a built-in way to migrate Essence#{type} records to Ingredients?

@tvdeyen
Copy link
Member

tvdeyen commented Dec 22, 2022

Yes, the above mentioned task

@chiperific
Copy link
Contributor Author

Do I need to change something in my elements.yml file? running the task seems to do nothing.

I tried changing contents: to ingredients:, but then the task fails with an error about "Role is undefined"

@chiperific
Copy link
Contributor Author

chiperific commented Dec 22, 2022

>> Alchemy::Element.all.size
=> 56
>> Alchemy::Ingredient.all.size
=> 0

$ rake alchemy:upgrade:6.0:create_ingredients
Running via Spring preloader in process 4792

Create ingredients for elements with ingredients defined
--------------------------------------------------------
== Done.

>> Alchemy::Element.all.size
=> 56
>> Alchemy::Ingredient.all.size
=> 0

@tvdeyen
Copy link
Member

tvdeyen commented Dec 22, 2022

Sorry, you also need to change name to role for every ingredient.

Then run the task.

Some background in this change can be found in this PR #2061 (comment)

We really need to update the guides...

@chiperific
Copy link
Contributor Author

Ok, that worked. Could I drop the "alchemy_essence_#{type}" tables from the database now?

@tvdeyen
Copy link
Member

tvdeyen commented Dec 23, 2022

Since the Models are loaded in production and Rails would fail without the tables, I would not recommend that. They do no harm.

@tvdeyen tvdeyen closed this as completed Dec 23, 2022
@AlchemyCMS AlchemyCMS locked and limited conversation to collaborators Jan 18, 2023
@tvdeyen tvdeyen converted this issue into discussion #2411 Jan 18, 2023

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Projects
None yet
Development

No branches or pull requests

2 participants