No :original defined for 'some_file' is being presented in Ruby on Rails production log

StackOverflow https://stackoverflow.com/questions/22625554

  •  20-06-2023
  •  | 
  •  

Question

I'm noticing this as I run tail -f production.log. Here it is with more depth:

Processing by Spree::Admin::ProductsController#edit as HTML
  Parameters: {"id"=>"1"}
  Rendered /data/site/shared/bundled_gems/ruby/1.9.1/bundler/gems/spree-9c3a61024d8c/backend/app/views/spree/admin/shared/_product_sub_menu.html.erb (8.5ms)
  Rendered /data/site/shared/bundled_gems/ruby/1.9.1/bundler/gems/spree-9c3a61024d8c/backend/app/views/spree/admin/shared/_product_tabs.html.erb (8.3ms)
  Rendered spree/shared/_error_messages.html.erb (0.3ms)
Deface: [WARNING] No :original defined for 'add_book_fields_to_admin_products_form', you should change its definition to include:
 :original => '123dfjdlkfjdjflsdjf123'
Deface: [WARNING] No :original defined for 'insert_bottom_admin_product_form_right', you should change its definition to include:
 :original => '123dfjdlkfjdjflsdjf123'
Deface: [WARNING] No :original defined for 'add_custom_price_multiplier_field_to_admin_product_edit', you should change its definition to include:
 :original => '123dfjdlkfjdjflsdjf123'
  Rendered /data/site/shared/bundled_gems/ruby/1.9.1/bundler/gems/spree-9c3a61024d8c/backend/app/views/spree/admin/products/_form.html.erb (69.5ms)
  Rendered /data/site/shared/bundled_gems/ruby/1.9.1/bundler/gems/spree-9c3a61024d8c/backend/app/views/spree/admin/shared/_edit_resource_links.html.erb (1.8ms)
  Rendered /data/site/shared/bundled_gems/ruby/1.9.1/bundler/gems/spree-9c3a61024d8c/backend/app/views/spree/admin/products/edit.html.erb within spree/layouts/admin (489.8ms)
  Rendered /data/site/shared/bundled_gems/ruby/1.9.1/bundler/gems/spree-9c3a61024d8c/backend/app/views/spree/admin/shared/_translations.html.erb (2.6ms)
  Rendered /data/site/shared/bundled_gems/ruby/1.9.1/bundler/gems/spree-9c3a61024d8c/core/app/views/spree/shared/_routes.html.erb (0.4ms)
  Rendered /data/site/shared/bundled_gems/ruby/1.9.1/bundler/gems/spree-9c3a61024d8c/backend/app/views/spree/admin/shared/_routes.html.erb (3.5ms)
  Rendered /data/site/shared/bundled_gems/ruby/1.9.1/bundler/gems/spree-9c3a61024d8c/backend/app/views/spree/admin/shared/_head.html.erb (9.3ms)
  Rendered /data/site/shared/bundled_gems/ruby/1.9.1/bundler/gems/spree-9c3a61024d8c/backend/app/views/spree/admin/shared/_alert.html.erb (0.0ms)
  Rendered spree/admin/shared/_tabs.html.erb (321.5ms)

123dfjdlkfjdjflsdjf123 used to be a very long hash. I've removed all of them for security reasons. I'm using the spree framework. I've also found this error on their github as well as another SO question.

If anyone can let me know what's happening here, I'd love to get rid of these warnings. I'd also appreciate it if anyone is able to tell me what the :original symbol does and how it might be linked to Spree.

Était-ce utile?

La solution

The warnings are coming from Deface. Deface provides application developers and extension writers the ability to modify existing templates in order to modify their content.

For example, you can replace all content within #foo with content that you specify. It's quite powerful and allows you to make changes to Spree's content easily in a manner which is minimally invasive.

You do have one problem. What happens if in a future version of Spree, someone removes #foo. Then your content won't be inserted in place of #foo, because #foo doesn't exist. Your content won't show up at all.

In order to provide developers some insight in to when that has happened, deface computes a hash of the template it is operating upon, and compares that against the expected hash of the template which you developed against. Then in the future, if the template changes during a Spree version upgrade, you know that you should look at the template you're overriding and ensure that everything still works as you intended.

These warnings are likely coming from an extension (in your case, probably spree_gift_card) whose author has not specified original's for the templates they are overriding. You can file an issue with the author of the gem, or file a pull request to get them added.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top