deface icon indicating copy to clipboard operation
deface copied to clipboard

Original hash changing after reload

Open brchristian opened this issue 10 years ago • 6 comments

I'm having a hard time getting the :original hash for my Deface overrides to work correctly. It appears that the hash changes with every reload!

For instance, I wanted to override the following <h1>:

https://github.com/spree/spree_auth_devise/blob/2-2-stable/lib/views/frontend/spree/users/edit.html.erb#L4

So I wrote the following override:

Deface::Override.new(
  name: "edit_account_replace_title",
  virtual_path: "spree/users/edit",
  replace: "h1",
  text: "<h2>Edit Account</h2>"
)

However, I keep getting Deface warnings about needing an original hash:

Deface: 1 overrides found for 'spree/users/edit'
Deface: 'edit_account_replace_title' matched 1 times with 'h1'
Deface: [WARNING] No :original defined for 'edit_account_replace_title', you should change its definition to include:
 :original => 'a133eade5c9cf2b42192fcc1c6f5472ff6c29312' 

Reload...

Deface: 1 overrides found for 'spree/users/edit'
Deface: 'edit_account_replace_title' matched 1 times with 'h1'
Deface: [WARNING] No :original defined for 'edit_account_replace_title', you should change its definition to include:
 :original => '4e8af3b95c73312b6f5452dddf2dacd6f96c5daf' 

Am I missing something and am simply doing this wrong? The line that I'm overriding isn't dynamic, so what might be causing the hash to change like this?

brchristian avatar Jul 18 '14 19:07 brchristian

I have exactly the same issue.

msevestre avatar Jul 18 '14 19:07 msevestre

Same

BenMorganIO avatar Oct 20 '14 04:10 BenMorganIO

Is deface not supposed to be used anymore?

msevestre avatar Oct 20 '14 12:10 msevestre

This is a new one for me, I'll take a look and see if I can replicate.

BDQ avatar Oct 20 '14 12:10 BDQ

I know this issue was opened some months ago, but for people who have the same problem, it seems to be fixed (discussed in issue #130).

I had the same issue because the version of Deface I was using was too old...

magicienap avatar Jun 04 '15 18:06 magicienap

Yepp, this is fixed by #130.

@BDQ Could you release a deface 1.0.1 version with all the fixes from master?

felixbuenemann avatar Oct 21 '15 00:10 felixbuenemann