<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>HadleyNet.org</title>
    <description>The ongoing adventures of the Hadley family: Marc, Alison, Caleb and Alex
</description>
    <link>http://hadleynet.org/</link>
    <atom:link href="http://hadleynet.org/feed.xml" rel="self" type="application/rss+xml"/>
    <pubDate>Sat, 04 Feb 2023 12:06:45 -0500</pubDate>
    <lastBuildDate>Sat, 04 Feb 2023 12:06:45 -0500</lastBuildDate>
    <generator>Jekyll v4.3.1</generator>
    
      <item>
        <title>The Worst Journey</title>
        <description>&lt;p&gt;Due to some policy changes at work, I needed to take a week vacation at short notice or I would stop accruing additional paid time off. I decided to turn that particular lemon into lemonade by using the time for a visit to the UK.&lt;/p&gt;

&lt;p&gt;Flights were surprisingly pricey for the time of year but I did find a decent deal on Iceland Air flying to Manchester via Keflavik. I wish I hadn’t.&lt;/p&gt;

&lt;p&gt;Things started out well enough, my flight out of Boston left on time (midnight Iceland/UK, 7pm Boston time) and wasn’t totally full. The 767 was in good shape and the in-flight entertainment had a good selection of movies. The approach to Iceland was little bumpy but we touched down at 5:30am without incident and the plane started to make its way to the gate. After a short taxi we approached the terminal but instead of pulling into a gate we executed a sharp u-turn and came to a halt. The captain came over the PA to let us know that because of gusty winds he was unable to move the plane into the gate area and that we’d have to wait for a ground crew to arrive with stairs. Shortly after that he told us that it was too windy for the portable stairs to approach the plane.&lt;/p&gt;

&lt;p&gt;We stayed there, about 100yds from the terminal, for the next 12 hours. Every half hour or so the captain would come back on the PA to tell us that nothing had changed and that the ground crew were trying to figure out how to get us off the plane.&lt;/p&gt;

&lt;p&gt;My connection to the UK was scheduled to leave at 7:30am but that and pretty much every other flight in or out of Keflavik was cancelled that day. Later on we learned that IcelandAir had arranged hotels for people that were stranded and that more information would be available once we finally deplaned. I also got an email notification that I had been rebooked to Manchester via Amsterdam the following day but the 30min gap between planes had me very concerned.&lt;/p&gt;

&lt;p&gt;Around 5:30pm the captain’s tone changed from an apologetic mumble to something brighter and he announced that the plane would soon be moving to the gate. A good thing as the mood on board had turned sour, people were tired and hungry, and the toilets were getting pretty grim.&lt;/p&gt;

&lt;p&gt;Once we finally got off the plane I made my way to customer services where there were only two IcelandAir representatives to handle a huge line of passengers.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/keflavik_line.jpeg&quot; alt=&quot;Keflavik Queue&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Once I got to the head of the queue, I managed to persuade them that the rebooked itineray wouldn’t work and got them to re-rebook me on a direct flight to Heathrow instead. That done, I made my way to the next long queue to wait for a hotel transfer where I learned that all of the hotels were a 2 hours plus journey away by bus. It was nearly 8pm by this time and I’d need to back at the airport around 6:30am so, after being cooped up on an airplane for 18 hours, I decided to forgo that and stay overnight in the terminal.&lt;/p&gt;

&lt;p&gt;Keflavik airport is kind of Scandinavian in design, lots of wood and minimalist furniture. It looks great but its a really (really) uncomfortable place to spend a night. Here’s a picture to illustrate.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/keflavik_bench.jpeg&quot; alt=&quot;Keflavik Bench&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The next day, after very little sleep due to the uncomfortable conditions, I boarded my plane to Heathrow at 7:30am and suffered the final insult of a 1 hour wait to depart due to fog in London. Once we left Iceland, the rest of my journey passed smoothly, I got the Healthrow Express to London Paddington, the tube to Kings Cross, and then a train to Wakefield Westgate where Martin picked me up. A 14 hour sleep that night sorted me out.&lt;/p&gt;

&lt;p&gt;Door to door journey time was about 42 hours, about 30 hours longer than it should have been. I will never fly via Iceland in the winter again.&lt;/p&gt;
</description>
        <pubDate>Tue, 31 Jan 2023 15:22:00 -0500</pubDate>
        <link>http://hadleynet.org/travel/2023/01/31/Iceland.html</link>
        <guid isPermaLink="true">http://hadleynet.org/travel/2023/01/31/Iceland.html</guid>
        
        
        <category>travel</category>
        
      </item>
    
      <item>
        <title>Bicycle Tour</title>
        <description>&lt;p&gt;We’ve been reading &lt;a href=&quot;https://www.adventurecycling.org/adventure-cyclist/&quot;&gt;Adventure Cyclist&lt;/a&gt; magazine for about a year and all the great bicycle-travel stories inspired us to try our hand. With Alex away at scout camp and Caleb old enough to be left alone for a couple of days we decided this week was the time and planned a three-day, two-night inn-to-inn adventure of our own.&lt;/p&gt;

&lt;iframe src=&quot;https://www.google.com/maps/embed?pb=!1m58!1m12!1m3!1d373628.99587861134!2d-72.09291414805818!3d42.97876802995806!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!4m43!3e1!4m5!1s0x89e3c5e3ec10f09f%3A0xeb9f081db9290299!2sBrookline%2C+NH!3m2!1d42.7348102!2d-71.6581267!4m5!1s0x89e181c551edad95%3A0x910f7ef06892a413!2sHancock%2C+NH!3m2!1d42.9782657!2d-71.97569899999999!4m5!1s0x89e2238fcdae6931%3A0x8638db3373a0e238!2sHenniker%2C+NH!3m2!1d43.1798323!2d-71.82228719999999!4m5!1s0x89e217d33431026f%3A0x93c924c609faa65d!2sContoocook%2C+Hopkinton%2C+NH!3m2!1d43.2220234!2d-71.7139655!4m5!1s0x89e23d9472fa09b9%3A0xbf1ac5055d6fa2f1!2sHopkinton%2C+NH!3m2!1d43.1947744!2d-71.69106599999999!4m5!1s0x89e2238fcdae6931%3A0x8638db3373a0e238!2sHenniker%2C+NH!3m2!1d43.1798323!2d-71.82228719999999!4m5!1s0x89e3c5e3ec10f09f%3A0xeb9f081db9290299!2sBrookline%2C+NH!3m2!1d42.7348102!2d-71.6581267!5e0!3m2!1sen!2sus!4v1470508607588&quot; width=&quot;600&quot; height=&quot;450&quot; frameborder=&quot;0&quot; style=&quot;border:0&quot; allowfullscreen=&quot;&quot;&gt;&lt;/iframe&gt;

&lt;h1 id=&quot;equipment&quot;&gt;Equipment&lt;/h1&gt;

&lt;p&gt;Neither of our road bikes have the necessary braze-ons to add luggage and cycling a long distance with a rucksack isn’t ideal. Fortunately my mountain bike already had a rack so I decided to make a couple of modifications to that to make it more touring friendly:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;I swapped out the knobby off-road tires for a set of &lt;a href=&quot;https://amzn.com/B007JSOQLK&quot;&gt;Schwalbe Big Apples&lt;/a&gt;. I went for the 2in wide version so they wouldn’t look too ridiculous on a mountain bike like thinner tires can. These roll much easier than knobby tires but still offer a nice plush ride over bumpy road.&lt;/li&gt;
  &lt;li&gt;I swapped the flat handle bar for a &lt;a href=&quot;https://amzn.com/B00SVUP64G&quot;&gt;Modolo Yuma&lt;/a&gt; trekking bar so I’d have more hand positions while riding. I figured that riding lots of miles with my hands spread wide on the flat bar would be tiring. The trekking bar worked well once I found a good spot for the brake and gear levers.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We both invested in rain jackets just-in-case and, for luggage, we bought a pair of &lt;a href=&quot;http://www.arkel-od.com/en/t-42-lite-touring-panniers.html&quot;&gt;Arkel T-42 panniers&lt;/a&gt; and an &lt;a href=&quot;http://www.arkel-od.com/en/small-handlebar-bike-bag.html&quot;&gt;Arkel small handlebar bag&lt;/a&gt;. Alison added a small velcro handlebar bag to her roadbike that we’ve had in the family for some time. It’s summer so we packed light with just enough clothes for off-the-bike evenings out. Total luggage weight was 26lbs, not too bad at all.&lt;/p&gt;

&lt;h1 id=&quot;day-1---home-to-hancock&quot;&gt;Day 1 - Home to Hancock&lt;/h1&gt;

&lt;iframe height=&quot;405&quot; width=&quot;590&quot; frameborder=&quot;0&quot; allowtransparency=&quot;true&quot; scrolling=&quot;no&quot; src=&quot;https://www.strava.com/activities/661090671/embed/33de13fe9ffc3fa993a7873eadedc6d705006809&quot;&gt;&lt;/iframe&gt;

&lt;p&gt;Our tour started on an overcast Monday with a promise of rain later. We followed our regular back-roads route to Milford and then headed into Wilton to begin the steady climb on Rt 31 towards Lyndeborough and Greenfield. The rain started a few miles short of Greenfield so we decided to take a coffee break at Delay’s Town &amp;amp; Country Store in the center of town. Afterwards we headed back out into the now heavy rain for the final six miles to the &lt;a href=&quot;http://www.hancockinn.com&quot;&gt;Hancock Inn&lt;/a&gt;, our accommodation for the night.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/20160804-Bicycle-Tour/hancock-inn.jpg&quot; /&gt;&lt;/p&gt;

&lt;p&gt;We arrived at the inn pretty well soaked after scaling the Forest Rd hill up from route 202. We were early for check in and our room wasn’t yet ready so we parked our bikes in the shed at the back of the inn and headed across the street for a delicious late lunch and more coffee at the &lt;a href=&quot;http://www.fiddleheadscatering.net&quot;&gt;Fiddleheads Cafe&lt;/a&gt;. Afterwards we settled into &lt;a href=&quot;http://www.hancockinn.com/room/franklin-pierce/&quot;&gt;our room&lt;/a&gt; for a hot shower and a couple of hours of relaxation before dinner.&lt;/p&gt;

&lt;h1 id=&quot;day-2---hancock-to-henniker&quot;&gt;Day 2 - Hancock to Henniker&lt;/h1&gt;

&lt;iframe height=&quot;405&quot; width=&quot;590&quot; frameborder=&quot;0&quot; allowtransparency=&quot;true&quot; scrolling=&quot;no&quot; src=&quot;https://www.strava.com/activities/662433122/embed/f154c0aef6e629c4946afed5484d7a81d6ccc859&quot;&gt;&lt;/iframe&gt;

&lt;p&gt;We started day two with a delicious breakfast at the inn and then gathered our things and set out on the short 20 mile ride to Henniker. I managed to miss an early turn so we ended up taking Rt 202 all the way into Antrim rather than the back roads we’d intended, fortunately traffic wasn’t bad and the road had a decently wide verge that we could use. After 16 miles or so we took a break along the banks of the Contoocook River where we shed our rain jackets and enjoyed the warmth of the sun.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/20160804-Bicycle-Tour/river.jpg&quot; /&gt;&lt;/p&gt;

&lt;p&gt;We then cycled the remaining few miles to the &lt;a href=&quot;http://www.colbyhillinn.com&quot;&gt;Colby Hill Inn&lt;/a&gt; where we were able to check in early and drop our bags. We headed back out for lunch at St George’s Cafe on Bridge St (the jalapeno and cheese bagel with jalapeno cream cheese was delicious) and then cycled a loop via Contoocook and Hopkinton to make up for the relatively small distance between our accommodations. We followed some of the &lt;a href=&quot;http://currierandivesbyway.org/along-the-byway&quot;&gt;Currier and Ives Scenic Byway&lt;/a&gt; but were disappointed in the section on Rt 202 between Hopkinton and Henniker: traffic speeding by at 60 mph does not make for a scenic or relaxing ride!&lt;/p&gt;

&lt;p&gt;On the return leg of the loop we stopped in at &lt;a href=&quot;http://www.hennikerbrewing.com/home.html&quot;&gt;Henniker Brewing&lt;/a&gt; for a cold, refreshing tasting flight.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/20160804-Bicycle-Tour/beer.jpg&quot; /&gt;&lt;/p&gt;

&lt;p&gt;In the evening we attended a free jazz concert by &lt;a href=&quot;https://www.facebook.com/swingrocketmusic/&quot;&gt;Swing Rocket&lt;/a&gt; at the Henniker band stand and enjoyed take-out pizza and fries from Sonny’s Main Street Pizza just across the street.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/20160804-Bicycle-Tour/music.jpg&quot; /&gt;&lt;/p&gt;

&lt;h1 id=&quot;day-3---henniker-to-home&quot;&gt;Day 3 - Henniker to Home&lt;/h1&gt;

&lt;iframe height=&quot;405&quot; width=&quot;590&quot; frameborder=&quot;0&quot; allowtransparency=&quot;true&quot; scrolling=&quot;no&quot; src=&quot;https://www.strava.com/activities/663289518/embed/6ec159f89aba60afa496691f0372fa9a5ee8516e&quot;&gt;&lt;/iframe&gt;

&lt;p&gt;We started the final day of the tour with another delicious breakfast at the inn featuring lots of local organic produce - the leek and cheese frittata I had was amazing. We rode home via Weare, New Boston and Mont Vernon but the combination of heat and lots of hills made this the most challenging day by far. We stopped briefly in Mont Vernon for some emergency Gatorade and then plunged down the hill into Milford and onward to the final climb back into Brookline and home.&lt;/p&gt;

&lt;h1 id=&quot;things-we-learned&quot;&gt;Things We Learned&lt;/h1&gt;

&lt;ul&gt;
  &lt;li&gt;Bicycle travel is a lot of fun and we definitely plan to do more&lt;/li&gt;
  &lt;li&gt;There are some lovely country inns out there, the two we stayed at were great and were both listed by &lt;a href=&quot;http://www.selectregistry.com&quot;&gt;Select Registry&lt;/a&gt; which we’ll consult again for our next trip&lt;/li&gt;
  &lt;li&gt;Buying rain jackets was a great idea!&lt;/li&gt;
  &lt;li&gt;If I ever buy a dedicated bike for touring it will have nice low gears for hills!&lt;/li&gt;
&lt;/ul&gt;

</description>
        <pubDate>Thu, 04 Aug 2016 07:05:00 -0400</pubDate>
        <link>http://hadleynet.org/outdoors/2016/08/04/Bicycle-Tour.html</link>
        <guid isPermaLink="true">http://hadleynet.org/outdoors/2016/08/04/Bicycle-Tour.html</guid>
        
        
        <category>outdoors</category>
        
      </item>
    
      <item>
        <title>Let's Off Road</title>
        <description>&lt;p&gt;&lt;img src=&quot;/assets/jeeps.jpg&quot; alt=&quot;Jeeps lined up&quot; /&gt;&lt;/p&gt;

&lt;p&gt;I’ve owned my Jeep Wrangler for nearly a year now but its off-road prowess has so far only been tested on fields, maintained dirt roads, and one easy trail. I’ve been wanting to try something a bit more challenging for a while but didn’t want to head out on my own and get stuck like these guys from the Fast Show.&lt;/p&gt;

&lt;center&gt;&lt;iframe frameborder=&quot;0&quot; width=&quot;480&quot; height=&quot;270&quot; src=&quot;//www.dailymotion.com/embed/video/x2v1b05&quot; allowfullscreen=&quot;&quot;&gt;&lt;/iframe&gt;&lt;/center&gt;

&lt;p&gt;When I saw that the &lt;a href=&quot;http://baystatejeepers.com&quot;&gt;Bay State Jeepers&lt;/a&gt; club was hosting a &lt;a href=&quot;http://baystatejeepers.com/forum/viewtopic.php?f=4&amp;amp;t=4570&quot;&gt;Jeep 101&lt;/a&gt; event I immediately signed up and it didn’t take much persuasion to get Caleb to join me.&lt;/p&gt;

&lt;p&gt;The event was very well attended with at least 30 Jeep owners new to off road driving and some seasoned club members to lead the way. The day started with a series of short talks on things like safety, equipment and trail etiquette. After the talks we were instructed on how to air-down our tires to a lower pressure for better grip and control off road - I’m still running stock “all terrain” tires so I lowered mine to 15psi, a more off-road oriented tire would allow lower pressures.&lt;/p&gt;

&lt;p&gt;Next we ran through a series of exercises including balancing on logs, driving over  bricks to find low points on the vehicle and estimate available ground clearance, and finally driving one front wheel up a long ramp to determine how far the front axle would articulate before lifting a wheel.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/jeep_ramp.jpg&quot; alt=&quot;Jeep exercises&quot; /&gt;&lt;/p&gt;

&lt;p&gt;After a nice lunch provided by the club we formed up into two groups and headed out to the trail.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/jeep_line.jpg&quot; alt=&quot;Jeeps on the trail&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The first part of the trail was fairly easy with only a few small logs and branches to get over. The main challenge was somewhat tight turns and squeezing between trees, less of a problem for 2-door Jeeps like mine but I saw a couple of the 4-door drivers having some issues. Things got more difficult when we encountered rocks.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/jeep_rocks.jpg&quot; alt=&quot;Jeeps on rocks&quot; /&gt;&lt;/p&gt;

&lt;p&gt;A stock Jeep Wrangler has pretty good ground clearance but some of the rocks we climbed over were obviously too high and the grinding noises I heard several times as rock encountered Jeep made me wish I had a suspension lift and bigger tires. The biggest scare of the day came when I slid sideways off a rock and came within inches of a tree, fortunately I stopped before any damage was done and managed to scale the obstacle on my second try, albeit with further grinding noises.&lt;/p&gt;

&lt;p&gt;We’d been warned earlier about a hill climb that one unfortunate club member had issues on the week before. He’d lost traction, reversed and hit a tree on the way back damaging his fender and rear light. The hill climb came right after my slideways slide and I was pretty nervous looking at the long steep rise, fortunately I made it up the hill without issue and was really impressed with my Jeeps climbing abilities with stock road-friendly tires.&lt;/p&gt;

&lt;p&gt;We left the trail shortly after and went in search of air to re-inflate our tires before heading home. Next time I’ll bring a pump.&lt;/p&gt;

&lt;p&gt;My thanks to &lt;a href=&quot;http://baystatejeepers.com&quot;&gt;Bay State Jeepers&lt;/a&gt; for a fun day out. The Jeep escaped with only minor scrapes to the undercarriage but I’m now busy researching suspension lifts and big tires ;-).&lt;/p&gt;

</description>
        <pubDate>Sat, 09 Apr 2016 15:28:00 -0400</pubDate>
        <link>http://hadleynet.org/outdoors/2016/04/09/Offroad.html</link>
        <guid isPermaLink="true">http://hadleynet.org/outdoors/2016/04/09/Offroad.html</guid>
        
        
        <category>outdoors</category>
        
      </item>
    
      <item>
        <title>Devise and Sessions</title>
        <description>&lt;p&gt;If you are looking for a simple way to add security to a Ruby on Rails application then &lt;a href=&quot;https://rubygems.org/gems/devise&quot;&gt;Devise&lt;/a&gt; is really simple to use but there’s a lot of magic going on under the covers that is easy to screw up. E.g. if, like me, you create a new resource called ‘session’ then you are in for a world of hurt. Fortunately the solution isn’t too bad.&lt;/p&gt;

&lt;p&gt;The first thing to do is to add &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;:as&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;:path&lt;/code&gt; qualifiers to your routes file like this:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;resources :sessions, :as =&amp;gt; 'karate_sessions', :path =&amp;gt; 'karate_sessions'
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;In this case I’m renaming the generated path methods and the paths used to access the new resource. Then you need to add explicit path methods in place of implicit one. E.g. in your show view template instead of:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;link_to 'Edit', @session
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;you’ll need something like:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;link_to 'Edit', edit_karate_session_path(@session)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Similarly in your edit/create form you’ll need to replace:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;form_for(@session)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;with&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;form_for(@session, :url =&amp;gt; @session.id ? karate_session_path(@session) : karate_sessions_path)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;You’ll also need to do similar edits in the session_controller for any redirects or other implicit resource path generators.&lt;/p&gt;
</description>
        <pubDate>Mon, 16 Mar 2015 15:28:00 -0400</pubDate>
        <link>http://hadleynet.org/tech/2015/03/16/Counters.html</link>
        <guid isPermaLink="true">http://hadleynet.org/tech/2015/03/16/Counters.html</guid>
        
        
        <category>tech</category>
        
      </item>
    
      <item>
        <title>Migrating Rails Data and Resetting Auto-increment Counters</title>
        <description>&lt;p&gt;I recently switched a Rails database from the default SQLite3 to Postgres so I could move it to Heroku. The database contained a bunch of data that I wanted to preserve so the first step was to figure out to move it over. I tried the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;taps&lt;/code&gt; gem and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pgloader&lt;/code&gt; but ran into issues with both so I eventually just wrote the following couple of rake tasks:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;desc &quot;Export DB to JSON&quot;
task :dump, [:path] =&amp;gt; :environment do |t, args|
  path = File.expand_path(args.path)
  ['Color', 'Style', 'Test', 'Rank', 'Person', 'Session', 'Award', 'Attendance', 'User'].each do |model|
    File.open(File.join(path, &quot;#{model}.json&quot;), 'w') do |file|
      items = model.constantize.all.collect {|item| item.attributes}
      JSON.dump(items, file)
    end
  end
end
 
desc &quot;Import DB from JSON&quot;
task :load, [:path] =&amp;gt; :environment do |t, args|
  path = File.expand_path(args.path)
  ['Color', 'Style', 'Test', 'Rank', 'Person', 'Session', 'Award', 'Attendance', 'User'].each do |model|
    File.open(File.join(path, &quot;#{model}.json&quot;), 'r') do |file|
      JSON.load(file).each do |item|
        model.constantize.new(item).save
      end
    end
  end
end
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The first just dumps each table to a JSON file using the corresponding Rails models. The second loads those JSON files into the new database.&lt;/p&gt;

&lt;p&gt;Everything worked fine until I tried to add anything new to the DB then I got the following error:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;ERROR: duplicate key value violates unique constraint DETAIL: Key (id)=(1) already exists
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The problem was that the new database assumed that the auto-increment field value should start back at 1 and ignored the data I just added which had pre-assigned IDs. The following one liner in the Rails console did the trick:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;ActiveRecord::Base.connection.tables.each { |t| ActiveRecord::Base.connection.reset_pk_sequence!(t) }
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
</description>
        <pubDate>Mon, 16 Mar 2015 15:28:00 -0400</pubDate>
        <link>http://hadleynet.org/tech/2015/03/16/Sessions.html</link>
        <guid isPermaLink="true">http://hadleynet.org/tech/2015/03/16/Sessions.html</guid>
        
        
        <category>tech</category>
        
      </item>
    
      <item>
        <title>Chip and What</title>
        <description>&lt;p&gt;I just got an exciting new replacement card from Amex sporting a new technology called “&lt;a href=&quot;https://www.americanexpress.com/us/content/chip/signature.html&quot;&gt;chip and signature&lt;/a&gt;”. Yes, you read that right, chip and &lt;em&gt;signature&lt;/em&gt;. Why not chip and PIN you ask, I’ve no idea. Seems like an opportunity missed.&lt;/p&gt;
</description>
        <pubDate>Thu, 29 Jan 2015 03:15:00 -0500</pubDate>
        <link>http://hadleynet.org/misc/2015/01/29/chip-and-what.html</link>
        <guid isPermaLink="true">http://hadleynet.org/misc/2015/01/29/chip-and-what.html</guid>
        
        
        <category>misc</category>
        
      </item>
    
      <item>
        <title>Winter Hike</title>
        <description>&lt;p&gt;We took a lunchtime hike out on some of the trails maintained by the &lt;a href=&quot;http://www.noreasters.org&quot;&gt;Hollis Nor’Easters&lt;/a&gt;. We started at the site of the former town of &lt;a href=&quot;http://www.hollisnh.org/windowsonhollispast/placesToVisit/sites/monson.htm&quot;&gt;Monson, NH&lt;/a&gt;.&lt;/p&gt;

&lt;figure&gt;
  &lt;img src=&quot;/assets/monson.jpg&quot; /&gt;
  &lt;figcaption&gt;Rebuilt Gould house at Monson&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;We made a loop via Mill Road, Hayden Road, the Birch Hill cell tower, and then back to Monson via the main 501S trail.&lt;/p&gt;

&lt;figure&gt;
  &lt;img src=&quot;/assets/trail.jpg&quot; /&gt;
  &lt;figcaption&gt;Section of trail between Mill Road and Hayden Road&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;Temperature was a relatively mild (for this time of year) 25F with just a light breeze. A little over 5 miles in total on an inch or two of packed snow. Now feeling suitably tired and looking forward to a roast chicken dinner.&lt;/p&gt;
</description>
        <pubDate>Sun, 11 Jan 2015 10:29:00 -0500</pubDate>
        <link>http://hadleynet.org/outdoors/2015/01/11/Winter-Hike.html</link>
        <guid isPermaLink="true">http://hadleynet.org/outdoors/2015/01/11/Winter-Hike.html</guid>
        
        
        <category>outdoors</category>
        
      </item>
    
      <item>
        <title>Brrrr</title>
        <description>&lt;p&gt;A brisk 1F/-17C this morning at 8:30am. As Tom Waits once said: “it’s colder than a ticket takers smile at the Ivar Theatre on a Saturday night”.&lt;/p&gt;
</description>
        <pubDate>Thu, 08 Jan 2015 03:30:00 -0500</pubDate>
        <link>http://hadleynet.org/weather/2015/01/08/Brrrr.html</link>
        <guid isPermaLink="true">http://hadleynet.org/weather/2015/01/08/Brrrr.html</guid>
        
        
        <category>weather</category>
        
      </item>
    
      <item>
        <title>School Concert</title>
        <description>&lt;p&gt;Alex plays saxophone in the school orchestra. You can’t see him (he was at the back) but here’s a selection from tonight’s concert.&lt;/p&gt;

&lt;video width=&quot;640&quot; height=&quot;360&quot; controls=&quot;&quot;&gt;
  &lt;source src=&quot;/assets/WeWishYouAMerryChristmas.mov&quot; type=&quot;video/mp4&quot; /&gt;
Your browser does not support the video tag.
&lt;/video&gt;
</description>
        <pubDate>Thu, 11 Dec 2014 15:00:00 -0500</pubDate>
        <link>http://hadleynet.org/music/2014/12/11/School-Concert.html</link>
        <guid isPermaLink="true">http://hadleynet.org/music/2014/12/11/School-Concert.html</guid>
        
        
        <category>music</category>
        
      </item>
    
      <item>
        <title>Frog on Fire</title>
        <description>&lt;p&gt;Nice example of &lt;a href=&quot;http://en.wikipedia.org/wiki/Pareidolia&quot;&gt;pareidolia&lt;/a&gt; spotted in our wood burning stove.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/Frog.jpg&quot; alt=&quot;Burning log that looks like a frog head&quot; /&gt;&lt;/p&gt;
</description>
        <pubDate>Wed, 10 Dec 2014 16:30:00 -0500</pubDate>
        <link>http://hadleynet.org/misc/2014/12/10/Frog-On-Fire.html</link>
        <guid isPermaLink="true">http://hadleynet.org/misc/2014/12/10/Frog-On-Fire.html</guid>
        
        
        <category>misc</category>
        
      </item>
    
  </channel>
</rss>
