small medium large xlarge

12 Oct 2017, 19:16
David Wilbur (49 posts)

if you make a mistake in how you initially wrote the files for the “Chapter 13. Task H: Entering Additional Payment Details • 206” activity.

it seems that you can end up spending a fair bit of time tracking down what you did wrong.

in my case it was because it had placed files in public/packs/ that were the state of things I had initially done that were incorrect, (at least that is my impression) and it wasn’t until I had deleted that folder that things stopped referring to the code there and regenerated what was there.

also, using what was in depot_pb became hard to use as a reference since

diff -rq (path to my depot)/app (path to depot_pb)/app

resulted in many misleading “differences” due to every file in depot_pb starting with:

diff -r app/mailers/application_mailer.rb app.pb/mailers/application_mailer.rb
> #---
> # Excerpted from "Agile Web Development with Rails 5",
> # published by The Pragmatic Bookshelf.
> # Copyrights apply to this code. It may not be used to create training material,
> # courses, books, articles, and the like. Contact us if you are in doubt.
> # We make no guarantees that this code is fit for any purpose.
> # Visit for more book information.
> #---

even in cases where it was autogenerated by rails and not by the authors of the book.

also, depot_pb incorporates some of the prior exercises that they reader may not have done so those show up as differences too. eg:

require 'active_model/serializers/xml'
class Product < ApplicationRecord
  include ActiveModel::Serializers::Xml

anyway, is there a way to have it… say by some configuration setting… to in effect recompile what is placed in public every time the server is restarted? because it seemed to automatically do that once I deleted the folder in public.

12 Oct 2017, 20:02
David Copeland (467 posts)

The configuration with webpacker 3 should recompile your packs when they change. Not sure it can be compiled to do what you are suggesting, but you could use a script or rake task instead of bin/rails s that deletes them, e.g. rm -rf public/packs ; bin/rails s

You must be logged in to comment