Skip to content

Commit

Permalink
Merge pull request #220 from spree/elia/fix-1-8-with-rails-6
Browse files Browse the repository at this point in the history
Fix v1.8 with rails 6+
  • Loading branch information
elia authored Mar 26, 2021
2 parents 6a9807e + 37e6a53 commit 5192027
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
6 changes: 5 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@ require 'rdoc/task'
require 'rspec'
require 'rspec/core/rake_task'

require 'bundler'
Bundler.require
Bundler::GemHelper.install_tasks

desc 'Default: run specs'
task :default => :spec
task :default => :spec
RSpec::Core::RakeTask.new do |t|
t.pattern = "spec/**/*_spec.rb"
end
10 changes: 8 additions & 2 deletions lib/deface/action_view_extensions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,19 @@ def encode!
@handler = ActionView::Template::Handlers::ERB

# Modify the existing string instead of returning a copy
@source.replace Deface::Override.apply_overrides(
new_source = Deface::Override.apply_overrides(
Deface::Override.convert_source(source, syntax: syntax),
overrides: overrides
)

if Deface.before_rails_6?
@source.replace new_source
else
source.replace new_source
end
end

@source
source
end

private
Expand Down

0 comments on commit 5192027

Please sign in to comment.