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

Can't pass locals to a partial cleanly (i.e. not via ERB string) #158

Open
parkeristyping opened this issue May 13, 2016 · 0 comments
Open

Comments

@parkeristyping
Copy link

There doesn't seem to be a clean way to pass locals to a partial.

I'd like to be able to use this syntax, but it doesn't work (at least it's not working for me in Deface 1.0.2):

Deface::Override.new(
  virtual_path: "spree/layouts/spree_application",
  name: "frontend_add_google_tag_manager",
  insert_top: "body[data-hook='body']",
  partial: 'spree/shared/google_tag_manager',
  locals: { container_id: Rails.application.config.google_tag_manager[:container_id] },
)

The following works, but it's not very pretty since there's so much in the text: string:

Deface::Override.new(
  virtual_path: "spree/layouts/spree_application",
  name: "frontend_add_google_tag_manager",
  insert_top: "body[data-hook='body']",
  text: "<%= render partial: 'spree/shared/google_tag_manager', locals: { container_id: Rails.application.config.google_tag_manager[:container_id] } %>",
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant