0% found this document useful (0 votes)
18 views

Agile Web Development with Rails 6 1st Edition Sam Ruby - Quickly download the ebook to read anytime, anywhere

The document promotes a collection of ebooks focused on web development with Ruby on Rails, including titles like 'Agile Web Development with Rails 6' and 'Ruby on Rails Tutorial 6th Edition.' It emphasizes the ease of downloading and reading these resources across various devices without digital restrictions. Additionally, it highlights the Pragmatic Bookshelf's commitment to providing practical and timely content for developers.

Uploaded by

zamnimteusz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

Agile Web Development with Rails 6 1st Edition Sam Ruby - Quickly download the ebook to read anytime, anywhere

The document promotes a collection of ebooks focused on web development with Ruby on Rails, including titles like 'Agile Web Development with Rails 6' and 'Ruby on Rails Tutorial 6th Edition.' It emphasizes the ease of downloading and reading these resources across various devices without digital restrictions. Additionally, it highlights the Pragmatic Bookshelf's commitment to providing practical and timely content for developers.

Uploaded by

zamnimteusz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 67

Explore the full ebook collection and download it now at textbookfull.

com

Agile Web Development with Rails 6 1st Edition Sam


Ruby

https://textbookfull.com/product/agile-web-development-with-
rails-6-1st-edition-sam-ruby/

OR CLICK HERE

DOWLOAD EBOOK

Browse and Get More Ebook Downloads Instantly at https://textbookfull.com


Click here to visit textbookfull.com and download textbook now
Your digital treasures (PDF, ePub, MOBI) await
Download instantly and pick your perfect format...

Read anywhere, anytime, on any device!

Learn Rails 6: Accelerated Web Development with Ruby on


Rails Adam Notodikromo

https://textbookfull.com/product/learn-rails-6-accelerated-web-
development-with-ruby-on-rails-adam-notodikromo/

textbookfull.com

RUBY Beginner s Crash Course Ruby for Beginners Guide to


Ruby Programming Ruby On Rails Rails Programming 2nd
Edition Quick Start Guides
https://textbookfull.com/product/ruby-beginner-s-crash-course-ruby-
for-beginners-guide-to-ruby-programming-ruby-on-rails-rails-
programming-2nd-edition-quick-start-guides/
textbookfull.com

Ruby on Rails Tutorial 6th Edition Michael Hartl

https://textbookfull.com/product/ruby-on-rails-tutorial-6th-edition-
michael-hartl/

textbookfull.com

Beginning Rails 6: From Novice to Professional Brady


Somerville

https://textbookfull.com/product/beginning-rails-6-from-novice-to-
professional-brady-somerville/

textbookfull.com
Wanted Lion Black Ops Mates 6 1st Edition Ruby Knoxx

https://textbookfull.com/product/wanted-lion-black-ops-mates-6-1st-
edition-ruby-knoxx/

textbookfull.com

Practical object-oriented design: an agile primer using


Ruby Second Edition Metz

https://textbookfull.com/product/practical-object-oriented-design-an-
agile-primer-using-ruby-second-edition-metz/

textbookfull.com

Vue on Rails: End-to-End Guide to Building Web Apps Using


Vue.js and Rails Bryan Lim

https://textbookfull.com/product/vue-on-rails-end-to-end-guide-to-
building-web-apps-using-vue-js-and-rails-bryan-lim/

textbookfull.com

Flask Web Development Developing Web Applications With


Python 2nd Edition Miguel Grinberg

https://textbookfull.com/product/flask-web-development-developing-web-
applications-with-python-2nd-edition-miguel-grinberg/

textbookfull.com

Beginning Rails 6: From Novice to Professional 4th Edition


Brady Somerville

https://textbookfull.com/product/beginning-rails-6-from-novice-to-
professional-4th-edition-brady-somerville/

textbookfull.com
Agile Web Development with
Rails 6
BY SAM RUBY, DAVID BRYANT COPELAND, WITH
DAVE THOMAS
Version: P1.0 (February 2020)
Copyright © 2020 The Pragmatic Programmers,
LLC. This book is licensed to the individual who
purchased it. We don't copy-protect it because that
would limit your ability to use it for your own
purposes. Please don't break this trust—you can
use this across all of your devices but please do not
share this copy with other members of your team,
with friends, or via file sharing services. Thanks.

Many of the designations used by manufacturers


and sellers to distinguish their products are
claimed as trademarks. Where those designations
appear in this book, and The Pragmatic
Programmers, LLC was aware of a trademark
claim, the designations have been printed in initial
capital letters or in all capitals. The Pragmatic
Starter Kit, The Pragmatic Programmer, Pragmatic
Programming, Pragmatic Bookshelf and the linking
g device are trademarks of The Pragmatic
Programmers, LLC.

Every precaution was taken in the preparation of


this book. However, the publisher assumes no
responsibility for errors or omissions, or for
damages that may result from the use of
information (including program listings) contained
herein.

About the Pragmatic Bookshelf

The Pragmatic Bookshelf is an agile publishing


company. We’re here because we want to improve
the lives of developers. We do this by creating
timely, practical titles, written by programmers for
programmers.

Our Pragmatic courses, workshops, and other


products can help you and your team create better
software and have more fun. For more
information, as well as the latest Pragmatic titles,
please visit us at http://pragprog.com.

Our ebooks do not contain any Digital Restrictions


Management, and have always been DRM-free. We
pioneered the beta book concept, where you can
purchase and read a book while it’s still being
written, and provide feedback to the author to help
make a better book for everyone. Free resources for
all purchasers include source code downloads (if
applicable), errata and discussion forums, all
available on the book's home page at
pragprog.com. We’re here to make your life easier.

NEW BOOK ANNOUNCEMENTS

Want to keep up on our latest titles and


announcements, and occasional special offers?
Just create an account on pragprog.com (an email
address and a password is all it takes) and select
the checkbox to receive newsletters. You can also
follow us on twitter as @pragprog.

ABOUT EBOOK FORMATS

If you buy directly from pragprog.com, you get


ebooks in all available formats for one price. You
can synch your ebooks amongst all your devices
(including iPhone/iPad, Android, laptops, etc.) via
Dropbox. You get free updates for the life of the
edition. And, of course, you can always come back
and re-download your books when needed. Ebooks
bought from the Amazon Kindle store are subject
to Amazon's polices. Limitations in Amazon's file
format may cause ebooks to display differently on
different devices. For more information, please see
our FAQ at pragprog.com/frequently-asked-
questions/ebooks. To learn more about this book
and access the free resources, go to
https://pragprog.com/book/rails6, the book's
homepage.

Thanks for your continued support,

Andy Hunt
The Pragmatic Programmers

The team that produced this book includes:


Andy Hunt (Publisher),
Janet Furlow (VP of Operations),
Dave Rankin (Executive Editor),
Adaobi Obi Tulton (Development Editor),
Sakhi MacMillan (Copy Editor),
Potomac Indexing, LLC (Indexing),
Gilson Graphics (Layout)

For customer support, please contact


[email protected].

For international rights, please contact


[email protected].
Table of Contents

1. Foreword to the Rails 5 Edition

2. Preface to the Rails 6 Edition

3. Acknowledgments

4. Introduction
1. Rails Simply Feels Right

2. Rails Is Agile
3. Who This Book Is For

4. How to Read This Book

5. Part I. Getting Started

1. 1. Installing Rails
1. Installing on Windows

2. Installing on macOS
3. Installing on Linux

4. Choosing a Rails Version


5. Setting Up Your Development Environment
6. Rails and Databases

2. 2. Instant Gratification
1. Creating a New Application

2. Hello, Rails!
3. Linking Pages Together
4. When Things Go Wrong
3. 3. The Architecture of Rails Applications
1. Models, Views, and Controllers

2. Rails Model Support


3. Action Pack: The View and Controller

4. 4. Introduction to Ruby
1. Ruby Is an Object-Oriented Language
2. Data Types

3. Logic
4. Organizing Structures
5. Marshaling Objects

6. Pulling It All Together


7. Ruby Idioms

6. Part II. Building an Application

1. 5. The Depot Application


1. Incremental Development
2. What Depot Does

3. Let’s Code

2. 6. Task A: Creating the Application


1. Iteration A1: Creating the Product Maintenance Application
2. Iteration A2: Making Prettier Listings

3. 7. Task B: Validation and Unit Testing


1. Iteration B1: Validating!

2. Iteration B2: Unit Testing of Models

4. 8. Task C: Catalog Display


1. Iteration C1: Creating the Catalog Listing
2. Iteration C2: Adding a Page Layout
3. Iteration C3: Using a Helper to Format the Price
4. Iteration C4: Functional Testing of Controllers
5. Iteration C5: Caching of Partial Results

5. 9. Task D: Cart Creation


1. Iteration D1: Finding a Cart

2. Iteration D2: Connecting Products to Carts


3. Iteration D3: Adding a Button

6. 10. Task E: A Smarter Cart


1. Iteration E1: Creating a Smarter Cart
2. Iteration E2: Handling Errors

3. Iteration E3: Finishing the Cart

7. 11. Task F: Add a Dash of Ajax


1. Iteration F1: Moving the Cart
2. Iteration F2: Creating an Ajax-Based Cart

3. Iteration F3: Highlighting Changes


4. Iteration F4: Hiding an Empty Cart with a Custom Helper
5. Iteration F5: Broadcasting Updates with Action Cable

8. 12. Task G: Check Out!


1. Iteration G1: Capturing an Order

2. Iteration G2: Atom Feeds

9. 13. Task H: Entering Additional Payment Details


1. Iteration H1: Adding Fields Dynamically to a Form
2. Iteration H2: Testing Our JavaScript Functionality

14. Task I: Sending Emails and Processing Payments


10. Efficiently

1. Iteration I1: Sending Confirmation Emails

Iteration I2: Connecting to a Slow Payment Processor


2. with Active Job
11. 15. Task J: Logging In
1. Iteration J1: Adding Users

2. Iteration J2: Authenticating Users


3. Iteration J3: Limiting Access
4. Iteration J4: Adding a Sidebar, More Administration

12. 16. Task K: Internationalization


1. Iteration K1: Selecting the Locale

2. Iteration K2: Translating the Storefront


3. Iteration K3: Translating Checkout
4. Iteration K4: Adding a Locale Switcher

17. Task L: Receive Emails


13. and Respond with Rich Text
1. Iteration L1: Receiving Support Emails with Action Mailbox
2. Iteration L2: Storing Support Requests from Our Mailbox
3. Iteration L3: Responding with Rich Text

7. Part III. Rails in Depth

1. 18. Finding Your Way Around Rails


1. Where Things Go

2. Naming Conventions

2. 19. Active Record


1. Defining Your Data
2. Locating and Traversing Records
3. Creating, Reading, Updating, and Deleting (CRUD)

4. Participating in the Monitoring Process


5. Transactions

3. 20. Action Dispatch and Action Controller


1. Dispatching Requests to Controllers
2. Processing of Requests
3. Objects and Operations That Span Requests

4. 21. Action View


1. Using Templates

2. Generating Forms
3. Processing Forms
4. Uploading Files to Rails Applications

5. Using Helpers
6. Reducing Maintenance with Layouts and Partials

5. 22. Migrations
1. Creating and Running Migrations

2. Anatomy of a Migration
3. Managing Tables
4. Advanced Migrations

5. When Migrations Go Bad


6. Schema Manipulation Outside Migrations

6. 23. Customizing and Extending Rails


1. Testing with RSpec

2. Creating HTML Templates with Slim


3. Serving CSS via Webpack
4. Customizing Rails in Other Ways

5. Where to Go from Here

8. Bibliography

Copyright © 2020, The Pragmatic Bookshelf.


Early Praise for Agile Web
Development with Rails 5.1
The best book to get started in the Rails world. A
comprehensive, coherent, and concise overview of the Ruby
on Rails framework. It treats learning in a gradual way,
creating an application from scratch using the latest
technologies.

→ Luis Miguel Cabezas Granado


Ruby on Rails and PHP developer at Junta de Extremadura
(Spain) and PHP book writer at Anaya Multimedia

I liked how the book guided me through each step of the


tasks. This book gives a thorough introduction to Rails, and
I’d suggest it to anyone who wants to start development
with Rails.

→ Gábor László Hajba


Software Developer, EBCONT Enterprise Technologies

The book was really pleasant to read; I liked how it creates a


foundational understanding of Rails with a realistic scenario
and then builds upon it for the more advanced topics.

→ Alessandro Bahgat
Software Engineer, Google
Foreword to the Rails 5
Edition
You’ve made a great decision to learn Ruby on Rails. The
language, framework, and community have never been in better
shape, and the community has never been easier to join than it
is today. The early days of the frontier are gone, and while some
of the cowboy excitement went with it, what we have instead is a
sophisticated, modern, and functional state.

The spoils of such progress will hopefully become apparent as


you work your way through this book. Ruby on Rails takes care
of an inordinate amount of what most developers need most of
the time. In the world of web development, that’s an awful lot!
An overwhelming lot at times.

But don’t be intimidated. You don’t need to understand every


fine point and every minutia before you can begin to make
progress. Ruby on Rails has been designed to flatten the
learning curve as much as possible while at the same time
encouraging you to level up over time.

Becoming an expert in full-stack web development won’t


happen overnight. Even Ruby on Rails can’t replace the
inherent depth of knowledge required to understand every
facet, from HTTP to databases to JavaScript to object-oriented
best practices to testing methodologies. One day you’ll be able
to converse fluently about all that, but don’t worry or expect
that to be “twenty-one days from now” (or whatever snake-oil
sales speak some publishers might try to push on you).

The journey from here to there is half the fun. You’ve arrived in
a community that cares an extraordinary amount about the
craft of writing great software for the web. This might seem a
little strange at first: is it really possible to care that much
whether an if-statement is at the beginning of a conditional or if
it’s an unless-statement at the end? Yes, yes it is. Helping more
programmers develop an eye for such details is a big part of our
mission here.

Because Ruby on Rails isn’t just about getting stuff done


quickly. That’s part of it, but it’s the lesser one. The greater
appeal is in making software for the web fun, rewarding, and
inspiring. To make learning all the nooks and crannies of our
crazy craft an adventure.

Every new version of Rails expands the scope of what we try to


tackle together. This is unapologetically not a minimalist
framework. And Rails 5 is no different. With this major new
version we’ve opened the door to a major new domain: the real-
time web. You’re in for a real treat here as well.

But let’s not get ahead of ourselves. You have much to learn,
and I can’t wait to see what you do with it. I’ve been
programming in Ruby and working on Rails for the past
thirteen years. It never ceases to inspire and motivate me to see
new developers discover our wonderful language and
framework for the first time. In some ways, I’m even jealous.

Welcome to Ruby on Rails!

David Heinemeier Hansson


Copyright © 2020, The Pragmatic Bookshelf.
Preface to the Rails 6
Edition
Rails 1.0 was released in December 2005. In the years since, it
has gone from a relatively unknown leading-edge tool to a
successful and stable foundation with a large set of associated
libraries that others benchmark themselves against.

The book you’re about to read was there from the start, and it
has evolved with Rails. It began as a full reference to a small
framework when online documentation was scarce and
inconsistent. It’s now an introduction to the entire Rails
ecosystem—one that leaves you with many pointers to more
information that you can explore based on your needs and
desires.

This book didn’t just evolve along with Rails: Rails evolved with
it. The content in this book has been developed in consultation
with the Rails core team. Not only is the code you’ll see in this
book tested against each release of Rails, but the converse is
also true: Rails itself is tested against the code in this book and
won’t be released until those tests pass.

So read this book with confidence that the scenarios not only
work but also describe how the Rails developers themselves feel
about how best to use Rails. We hope you get as much pleasure
out of reading this book as we had in developing it.
This book covers Rails 6. While some of the commands you’ll be
using are new, the underlying development model remains the
same. Even when new major features are added, such as the
ability to process incoming emails with Action Mailbox, changes
are evolutionary, not revolutionary.

Rails 6 introduced two major new features and a lot of small


improvements. While Rails has always had strong support for
sending emails, Rails’ ability to receive emails has been fairly
limited until Rails 6. Action Mailbox introduces the concept of
Mailboxes, which are controllers for processing incoming
emails. You can use mailboxes to access any part of an incoming
email, and then trigger any workflow or logic, the same as you
would in a normal controller.

Rails 6 also adds seamless support for rich-text editing and


management via Action Text. Action Text is an end-to-end
integration of the Trix rich text editor to your Rails app using
Active Storage. With almost no configuration, you can present a
rich text editor to your users, save that rich text, and render it
back wherever you want, either as formatted text or plain text.
This is a great example of how Rails takes what could be a
complicated set of disparate components and brings them
together so they work whenever you need them to.

We’ve also updated the setup instructions to focus on Windows,


macOS, and Linux. Since Cloud 9 was acquired by Amazon, it’s
now a bit more difficult to use as a way to learn Rails. To that
end, our setup instructions for Linux now assume you are doing
this inside a virtual machine, which should provide a stable,
repeatable environment in which to learn Rails. We’ll walk you
through that setup if you wish to learn Rails that way.

Copyright © 2020, The Pragmatic Bookshelf.


Acknowledgments
Rails is constantly evolving and, as it has, so has this book. Parts
of the Depot application were rewritten several times, and all of
the text and code was updated. The avoidance of features as
they become deprecated has repeatedly changed the structure of
the book, as what was once hot became just lukewarm.

So, this book would not exist without a massive amount of


assistance from the Ruby and Rails communities. And of course,
none of this would exist without the developers contributing to
Ruby on Rails every day. In particular, the Rails core team has
been incredibly helpful, answering questions, checking out code
fragments, and fixing bugs—even to the point where part of the
release process includes verifying that new releases of Rails
don’t break the examples provided in this book.

Sam Ruby and David Bryant Copeland

Copyright © 2020, The Pragmatic Bookshelf.


Introduction
Ruby on Rails is a framework that makes it easier to develop,
deploy, and maintain web applications. During the 13+ years
since its initial release, Rails went from being an unknown toy
to a worldwide phenomenon. More importantly, it has become
the framework of choice for the implementation of a wide range
of applications.

Why is that?
Rails Simply Feels Right
A large number of developers were frustrated with the
technologies they were using to create web applications. It
didn’t seem to matter whether they used Java, PHP, or .NET—
there was a growing sense that their jobs were just too damn
hard. And then, suddenly, along came Rails, and Rails was
easier.

But easy on its own doesn’t cut it. We’re talking about
professional developers writing real-world websites. They
wanted to feel that the applications they were developing would
stand the test of time—that they were designed and
implemented using modern, professional techniques. So, these
developers dug into Rails and discovered it wasn’t just a tool for
hacking out sites.

For example, all Rails applications are implemented using the


model-view-controller (MVC) architecture. MVC is not a new
concept for web development—the earliest Java-based web
frameworks (like Struts) base their design on it. But Rails takes
MVC further: when you develop in Rails, you start with a
working application, each piece of code has its place, and all the
pieces of your application interact in a standard way.

Professional programmers write tests. And again, Rails delivers.


All Rails applications have testing support baked right in. As
you add functionality to the code, Rails automatically creates
test stubs for that functionality. The framework makes it easy to
test applications, and, as a result, Rails applications tend to get
tested.
Rails applications are written in Ruby, a modern, object-
oriented language. Ruby is concise without being unintelligibly
terse. You can express ideas naturally and cleanly in Ruby code.
This leads to programs that are easy to write and (just as
important) easy to read months later.

Rails takes Ruby to the limit, extending it in novel ways that


make our programming lives easier. Using Rails makes our
programs shorter and more readable. It also allows us to
perform tasks that would normally be done in external
configuration files inside the codebase instead. This makes it far
easier to see what’s happening. The following code defines the
model class for a project. Don’t worry about the details for now.
Instead, think about how much information is being expressed
in a few lines of code:

​ c​ lass​Project < ApplicationRecord


​ belongs_to ​:portfolio​

​ has_one ​:project_manager​
​ has_many ​:milestones​
​ has_many ​:deliverables​, ​through: ​milestones

​ validates ​:name​, ​:description​, ​presence: ​true​
​ validates ​:non_disclosure_agreement​, ​acceptance: ​true​
​ validates ​:short_name​, ​uniqueness: ​true​
​ ​end​

A major philosophical underpinning of Rails that keeps code


short and readable is the DRY principle, which stands for Don’t
Repeat Yourself (see The Pragmatic Programmer, 20th
Anniversary Edition [Hun19]). Every piece of knowledge in a
system should be expressed in one place. Rails uses the power
of Ruby to bring that to life. You’ll find little duplication in a
Rails application; you say what you need to say in one place—a
place often suggested by the conventions of the MVC
architecture—and then move on. For programmers used to
other web frameworks, where a simple change to the database
schema could involve a dozen or more code changes, this was a
revelation—and it still is.

From that principle, Rails is founded on the Rails Doctrine,[1]


which is a set of nine pillars that explain why Rails works the
way it does and how you can be most successful in using it. Not
every pillar is relevant when just starting out with Rails, but one
pillar in particular is most important: convention over
configuration.

Convention over configuration means that Rails has sensible


defaults for just about every aspect of knitting together your
application. Follow the conventions, and you can write a Rails
application using less code than a typical JavaScript application
uses in JSON configuration. If you need to override the
conventions, Rails makes that easy, too.

Developers coming to Rails find something else, too. Rails


doesn’t merely play catch-up with the de facto web standards: it
helps define them. And Rails makes it easy for developers to
integrate features such as Ajax, modern JavaScript frameworks,
RESTful interfaces, and WebSockets into their code because
support is built in. (And if you’re not familiar with any of these
terms, never fear—you’ll learn what they mean as you proceed
through the book).

Rails was extracted from a real-world, commercial application.


It turns out that the best way to create a framework is to find
the central themes in a specific application and then package
them in a generic foundation of code. When you’re developing
your Rails application, you’re starting with half of a really good
application already in place.

But there’s something else to Rails—something that’s hard to


describe. Somehow, it feels right. Of course, you’ll have to take
our word for that until you write some Rails applications for
yourself (which should be in the next 45 minutes or so…). That’s
what this book is all about.
Rails Is Agile
The title of this book is Agile Web Development with Rails 6.
You may be surprised to discover that we don’t have explicit
sections on applying agile practices X, Y, and Z to Rails coding.
In fact, you won’t find mention of many agile practices, such as
Scrum or Extreme Programming, at all.

Over the years since Rails was introduced, the term agile has
gone from being relatively unknown, to being overhyped, to
being treated as a formal set of practices, to receiving a well-
deserved amount of pushback against formal practices that were
never meant to be treated as gospel, to a return back to the
original principles.

But it’s more than that. The reason is both simple and subtle.
Agility is part of the fabric of Rails.

Let’s look at the values expressed in the Agile Manifesto (Dave


Thomas was one of the seventeen authors of this document) as a
set of four preferences:[2]

Individuals and interactions over processes and tools

Working software over comprehensive documentation

Customer collaboration over contract negotiation

Responding to change over following a plan

Rails is all about individuals and interactions. It involves no


heavy toolsets, no complex configurations, and no elaborate
processes, just small groups of developers, their favorite editors,
and chunks of Ruby code. This leads to transparency; what the
developers do is reflected immediately in what the customer
sees. It’s an intrinsically interactive process.
The Rails development process isn’t driven by documents. You
won’t find 500-page specifications at the heart of a Rails
project. Instead, you’ll find a group of users and developers
jointly exploring their need and the possible ways of answering
that need. You’ll find solutions that change as both the
developers and the users become more experienced with the
problems they’re trying to solve. You’ll find a framework that
delivers working software early in the development cycle. This
software might be rough around the edges, but it lets the users
start to get a glimpse of what you’ll be delivering.

In this way, Rails encourages customer collaboration. When


customers see how quickly a Rails project can respond to
change, they start to trust that the team can deliver what’s
required, not just what’s been requested. Confrontations are
replaced by “What if?” sessions.

The agile way of working that Rails encourages is tied to the


idea of being able to respond to change. The strong, almost
obsessive, way that Rails honors the DRY principle means that
changes to Rails applications impact a lot less code than the
same changes would in other frameworks. And since Rails
applications are written in Ruby, where concepts can be
expressed accurately and concisely, changes tend to be localized
and easy to write. The deep emphasis on both unit and system
testing, along with support for test fixtures and stubs during
testing, gives developers the safety net they need when making
those changes. With a good set of tests in place, changes are less
nerve-racking.

Rather than constantly trying to link Rails processes to agile


principles, we’ve decided to let the framework speak for itself.
As you read through the tutorial chapters, try to imagine
yourself developing web applications this way, working
alongside your customers and jointly determining priorities and
solutions to problems. Then, as you read the more advanced
concepts that follow in Part III, see how the underlying
structure of Rails can enable you to meet your customers’ needs
faster and with less ceremony.

One last point about agility and Rails—although it’s probably


unprofessional to mention this—think how much fun the coding
will be!
Who This Book Is For
This book is for programmers looking to build and deploy web-
based applications. This includes application programmers who
are new to Rails (and perhaps even new to Ruby) as well as
those who are familiar with the basics but want a more in-depth
understanding of Rails.

We presume some familiarity with HTML, Cascading Style


Sheets (CSS), and JavaScript—in other words, the ability to view
source on web pages. You needn’t be an expert on these
subjects; the most you’ll be expected to do is copy and paste
material from the book, all of which can be downloaded.

The focus of this book is on the features and choices made by


the Rails core team. More specifically, this book is for users of
the Rails framework—people who tend to be more concerned
about what Rails does, as opposed to how it does it or how to
change Rails to suit their needs. Examples of topics not covered
in this book include the following:

Introduced in Rails 4, Turbolinks is a way to load pages more


[3]
quickly by just loading markup. If you want to know more about
how Rails makes your pages load faster, follow that link. But should
you instead be content with the knowledge that Rails makes pages
load fast and not need to know more, that’s OK too.

Rails itself is highly hackable and extensible, but this book doesn’t
[4]
cover the concept of how to create your own Rails engine. If that
topic is of interest to you, we highly recommend Crafting Rails 4
Applications [Val13] as a follow-on to this book.

The Rails team has chosen not to include plenty of features—such as


user authentication—in the Rails framework itself. That doesn’t
mean that these features aren’t important, but it generally does
mean that no single solution is the obvious default for Rails users.
How to Read This Book
The first part of this book makes sure you’re ready. By the time
you’re done with it, you’ll have been introduced to Ruby (the
language), you’ll have been exposed to an overview of Rails,
you’ll have Ruby and Rails installed, and you’ll have verified the
installation with a simple example.

The next part takes you through the concepts behind Rails via
an extended example: we build a simple online store. It doesn’t
take you one by one through each component of Rails (such as
“here’s a chapter on models, here’s a chapter on views,” and so
forth). These components are designed to work together, and
each chapter in this section tackles a specific set of related tasks
that involve a number of these components working together.

Most folks seem to enjoy building the application along with the
book. If you don’t want to do all that typing, you can cheat and
download the source code (a compressed tar archive or a zip
file).[5]

Be careful if you ever choose to copy files directly from the


download into your application: if the timestamps on the files
are old, the server won’t know that it needs to pick up these
changes. You can update the timestamps using the touch
command on either MacOS or Linux, or you can edit the file and
save it. Alternatively, you can restart your Rails server.

Part 3, ​Rails in Depth​, surveys the entire Rails ecosystem. This


starts with the functions and facilities of Rails that you’ll now be
familiar with. It then covers a number of key dependencies that
the Rails framework makes use of that contribute directly to the
overall functionality that the Rails framework delivers. Finally,
Another Random Document on
Scribd Without Any Related Topics
flame amid deafening roar and scream of shot and shell, that
brought every sleeper to his feet. The deep notes of the heavier
ordnance, mingled with the rifle crack of the lighter parrotts; the
whizzing of shot and screaming shells, the path of the latter marked
by burning fuse, presented a scene grand and awe-inspiring beyond
description. It was war's magnificent prelude to the fiercer music of
the clash of a hundred thousand muskets to follow. By daylight,
camps were broken, knapsacks packed, and marching columns were
pouring forward toward the river where the batteries continued to
play and pile their smoke in thick banks along the crest of the hills.
All day long we sat about our campfires in our dismantled quarters
waiting the order to move, but none came and darkness found us
replacing our shelters for another night's rest in our accustomed
berths. During the afternoon of the 12th our corps, the 3d, marched
to the extreme left of the line and bivouacked for the night in a piece
of woodland overlooking the river. The next day, the 13th, we
retraced our steps, halting just before noon at a point where we had
a magnificent panoramic view of the river, town and field, and down
into the valley, where could dimly be seen through the river mists
the long lines of blue with flying colors waiting the command to
storm the wooded heights beyond. Judged by the character of our
movements it looked as though we were to be spectators of the
struggle about to open. In the line of battle our place properly would
be with Hooker's grand division, which occupied the center, but
instead we were on the extreme left in support of Franklin. In this,
however, we were mistaken. About 12 o'clock the bugles sounded
and the order to fall in passed along the line, and without further
delay the long line of the 3d corps wound down the hill, crossed the
river on the lower pontoon bridge and from thence marched directly
out upon the plain to the front line of battle. That the hour to strike
for the possession of yonder wooded slopes, occupied by the
veterans of Jackson, had come was evident to all. From our right
came the crash and long roll of musketry, telling us that Hooker was
crowding the enemy in his front and we should not long be idle.
Soon Randolph's and other batteries in our front and on our flanks
began to feel for the enemy in the woods to our front. As we stood
intently watching the effect of the bursting shells a stream of smoke
shot out from a clump of trees and brush to our left center, and an
instant later a shell whizzed wickedly over our heads. The enemy's
cover was now revealed and on this piece of woodland the fire of
every gun in our batteries were concentrated. For a time he replied
with vigor, sending shot for shot. The voice of Colonel Campbell rang
out above the din: "Lie down." We waited not a second order, but
quickly and closely embraced our mother earth. Soon explosion
followed explosion in quick succession within the enemy's lines. A
shot from one of our guns had penetrated one of their caissons and
now their own exploding ammunition was doing its deadly work, and
silencing their only battery in position to do us immediate harm. Now
is the time to charge the heights! The Pennsylvania Reserves are
chosen for the hazardous task. In three lines, with arms at a right
shoulder shift, they advanced at a quick step. What a magnificent
spectacle! Not a man falters, but shoulder to shoulder they move
across the plain in perfect alignment. At the railroad in the edge of
the woods they encounter the enemy, who pour into their ranks a
withering fire. With a cheer they spring forward and press back the
foe. Soon they are lost to view amid the scrub pine, their location
only known by the curling smoke from their pieces and their cheers
as they ascend the hill. Over half way to the summit the second line
of the enemy is encountered. Again a galling fire is poured into their
faces, but still they cheer and press on. Down in the valley we stand
anxiously, but idly watching the now desperate and unequal contest
our comrades of the Old Keystone are waging. They are brothers,
friends and neighbors to many, if not all of us. A half mile intervenes
between them and us. We know we are not in supporting distance.
Our impatience overcomes our discipline to wait the word to
advance. Shouts are being heard all along the line: "Why are not the
Reserves being supported?" We know too keenly that they must
yield to the overpowering odds against them unless reinforced at
once!
"Battalion, right face, forward, file left, march!" rings out clear from
the colonel's lips. The men are quick to obey, and we move more
rapidly to the front. "By company, half wheel! Forward into line on
first company!" The movement was executed with alacrity. "Forward,
guide right." We pressed forward with quick step toward the woods
from which was now emerging the broken lines of the Reserves, not
in panic, but resolutely disputing, as best they could, every step. A
drainage ditch from three to four feet deep, grown up in many
places with a tangle of briers, extended along our front and parallel
with the railroad at the foot of the hills. Into this we were ordered in
the hope that by its protection we could stay the enemy's
countercharge. The Reserves were still in our front and to deliver an
effective fire was impossible. Orders to fall back were given, but in
the din of battle were unheard or unheeded, and many who
attempted the retreat were left dead or wounded on the field. The
enemy swarmed out of the woods in our front without order or
alignment, giving but little heed to the ditch, springing over the
heads of its occupants in their mad rush for our batteries. There was
not time for the gunners to debate the question of the safety of their
comrades in their front if they would save their batteries, and
possibly the day to our cause. They poured volley after volley of
grape and cannister into the advancing enemy, each discharge
mowing great swathes in their ranks. It was more than human flesh
could bear and soon they were in full retreat for the cover of the
woods, and thus ended, so far as the 57th was concerned, the battle
of Fredericksburg. In this short encounter, possibly lasting ten
minutes, the losses of the regiment were fearful, considering the
number engaged. Out of 316 men in line, 21 were killed, 76
wounded and 78 missing, 54 of whom were prisoners, 55.38 per
cent of the whole force engaged! Among the wounded was Colonel
Campbell, who fell pierced with three balls; Captain Strohecker, and
Surgeon Kennedy. During the 14th the remnant of the regiment
acted as provost guard to gather up stragglers until evening, when
we were again placed in the front line, where we remained until the
night of the 15th. During the 15th a truce was declared for the burial
of the dead, and removal of the wounded; the ghastly sequel of the
battle that robs it of its glory and drowns the acclaims of the victors
in the tears of the widowed and sobs of the orphans. During the
night of the 15th our army withdrew to the north side of the river,
leaving the Confederates the practical victors on the fiercely
contested field. The 57th, with shattered ranks, reoccupied its old
quarters, the empty tents and broken messes being sad reminders
of the horrors of war, and the uncertainty of the soldier's term of life.
Thus closed the second year of the war, and the first of service of
the 57th regiment for the preservation of the Union, amid scenes of
discomfiture, defeat and gloom.
CHAPTER VII.
BY E. C. STROUSS.

Camp Pitcher—The "Mud March"—General Hooker in Command of the Army—


Resolutions Adopted by the Fifty-Seventh—Re-assignment to the First Brigade
—Anecdote of Colonel Campbell—Drill and Inspection—Adoption of Corps
Badges—The Chancellorsville Campaign—Jackson Routs the Eleventh Corps—
A "Flying Dutchman"—In a Tight Place—General Hooker Disabled—General
Sedgwick's Movements—A New Line Established—Strength of the Fifty-
Seventh and Its Losses.

The old camp to which we returned after the battle was now, by
order of General Birney, called Camp Pitcher, in honor of Major
William Pitcher, a brave and gallant officer of the 4th Maine, who
was killed in the battle of Fredericksburg. The camp was located
near Falmouth on the west side of the Richmond & Potomac railroad.
Drill and the regular routine of camp life was resumed. The
paymaster soon made his appearance, and the humiliation of our
defeat in the recent battle, and our sorrow for comrades lost there,
had about vanished, when an order from army headquarters
announced another advance against the enemy.
The weather for a week or more had been bright and clear, the
roads frozen and in good order for the movement of the artillery and
trains, therefore General Burnside thought the time propitious for an
assault on the enemy. This time an attempt was to be made to turn
the enemy's left, and get in the rear of their position at
Fredericksburg.
Accordingly on the 20th of January, 1863, we broke camp at daylight
and our army was once more on the move. This expedition is known
to the old soldiers of the Army of the Potomac as "Burnside's Mud
March."
After a march of ten or fifteen miles up the Rappahannock we
reached the vicinity of Bank's Ford about dark, with the intention of
crossing there and driving the enemy from their works on the south
side of the river. About midnight a warm wind set in from the south,
the rain began to fall, and continued to fall with more or less
violence for the next three days. After two days of this kind of
weather the project of attacking the enemy was abandoned and we
got ready to go back to our old camps. The return march was a
great trial for the men. With the rain beating pitilessly, the roads and
fields soon became a vast sea of mud. Heavy details were made
from all the regiments to build corduroy roads in order to bring along
our trains and artillery. Finally we reached our old camp, where our
huts were still standing, and these were soon roofed with our shelter
tents and we were once more tolerably comfortable.
General Burnside was relieved from the command of the Army of the
Potomac, and was succeeded by Maj. Gen. Joseph Hooker on
January 24th. The announcement of Hooker's appointment was
hailed with delight by the officers and men of our (Birney's) division,
where his valor and ability were well known. He was one of the
original division commanders of our (3d) corps. We looked on him as
a man of the same stamp as the former commander of our division,
the lamented Kearny. The divisions of Hooker and Kearny had fought
side by side on the Peninsula and second Bull Run campaigns, where
they acquired renown and honor. The appointment of Hooker was
soon marked by an improvement in the commissary department and
in the drill and discipline of the army.
Soon after the battle of Fredericksburg certain evil-disposed
newspapers and persons at the North were loud in their assertions
that the Army of the Potomac was tired of the war, and demoralized,
and circulated reports derogatory to the character of that army. To
confute such reports, and to denounce those with whom they
originated, a meeting of the officers and men of the 57th was held
on February 26th, at which resolutions were adopted denouncing as
false the calumnious reports circulated concerning the army. One of
the resolutions declared that the 57th would sustain the government
in the future as in the past, a resolution which was made good in the
following December by three-fourths of the regiment re-enlisting for
three years. Our regiment was the first to adopt resolutions of this
nature which were ordered to be published in the newspapers in the
counties in which the regiment was raised. Our example was
followed by many of the regiments of the army.
Camp Pitcher, with its many pleasant and some unpleasant
associations, was abandoned on March 4th, when we moved about
four miles and laid out a new camp about a mile from the Potomac
creek bridge.
On the same day our regiment was reassigned to the First Brigade,
commanded by Colonel Collis, who was succeeded a few days
afterward by Gen. Charles K. Graham. The brigade consisted of the
following named Pennsylvania regiments: 57th, Colonel Sides; 63d,
Colonel Kirkwood; 68th, Colonel Tippen; 105th, Colonel McKnight;
114th, Colonel Collis; and 141st, Colonel Madill. Lieut-Colonel Sides,
formerly captain of Company A, of the 57th, returned to the
regiment on the field at Fredericksburg, and took command after
Colonel Campbell was wounded. The latter had been promoted
brigadier general, and when able for duty was assigned to the Army
of the Northwest, where the Indians of Minnesota and Dakota were
on the warpath and committing great depredations. Campbell had
wished to be assigned to a command in the Army of the Potomac,
and did not like to be sent West. About this time a friend of writer, J.
T. Chase, of Titusville, Pa., met Campbell in Harrisburg, and reported
him as saying: "The rebels tried their damnedest to kill me at Fair
Oaks and Fredericksburg, and now I'm to be sent out West to be
scalped by the Indians." The 57th were much attached to Campbell
and nothing would have pleased them more than to serve in a
brigade commanded by him.
As spring advanced we were kept busy with camp duties. Among
these were the frequent inspections, by companies, regiment, or
brigade. Guard mounting was by brigade, with great ceremony,
which was always witnessed by many officers and men who were
not on duty.
It was General Hooker who introduced the system of corps badges
into the army. The badge of each corps was of a different design
and were of different color in the several divisions of a corps, being
red for the first division, white for the second, and blue for the third.
The designs of the different corps badges were: 1st corps, a sphere;
2d, a trefoil; 3d, a diamond; 5th, a Maltese cross; 6th, a Greek
cross; 11th, a crescent; and 12th, a star. The badge was made of
cloth and was sewed on the top of the cap. By this arrangement,
one could tell at a glance to what corps and division a man
belonged, and it was of much importance in preventing straggling on
the march, or skulking in battle. The badge system was eventually
adopted by all other armies in the field. The 57th belonged to the
first division of the 3d corps, wore a red diamond, and are proud to
wear it today at all old soldiers' gatherings.
Toward the close of the month of April it became evident that
another movement against the enemy would soon be made. General
Hooker's plan was to send a large force up the river, to cross over
and turn the rebel left, at the same time sending a force to a point
below Fredericksburg to make a feint of crossing there. About eight
thousand cavalry under General Stoneman were to cross the upper
Rappahannock, gain the enemy's rear and destroy his railroad
communications and depots of supplies.
On April 27th the 11th and 12th corps crossed the Rappahannock at
Kelly's ford and moved to the Rapidan where, with little resistance
from the enemy, they crossed the river at Germania ford. The 5th
corps moved in the same direction, but crossed the Rapidan lower
down at Ely's ford. The three corps then marched towards
Chancellorsville, where they arrived on the afternoon of the 30th.
About 4 p. m. of the 28th the 3d corps broke camp and moved to
near Franklin's crossing, the place we had crossed on the 13th of
December. In the same vicinity were the 1st and 6th corps. The 2d
corps was in its camp opposite Fredericksburg. Our position here
was menacing, in order to distract the enemy's attention from the
flanking movement of the 5th, 11th and 12th corps, in which it was
successful.
On the 29th it rained most all day, and nothing was done on our part
of the line. On the morning of the 30th the rain had ceased when
the 2d corps started up the river, followed by the 3d corps about
noon. The march was skillfully masked to hide our movements from
the enemy. We marched that afternoon to Hartwood church, where
our brigade camped for the night, and next morning took a road to
the left and crossed the Rappahannock about noon at the United
States ford, which is located a few miles below the confluence of the
Rappahannock and Rapidan.
After a short halt for dinner we resumed our march and a few hours
later we reached the place now known by the historic name of
"Chancellorsville." There is, however, no village there. Only a large
brick house built for a hotel on account of the mineral springs in the
vicinity which were supposed to contain valuable medicinal
properties. The house was used by General Hooker as his
headquarters and on May 3d it was set on fire by the enemy's shells
and burned to the ground. We halted in a field near the brick house
for an hour or so, and then, accompanied by a battery, our brigade
moved west on the plank road until we reached Dowdell's tavern,
about two miles distant. This was the headquarters of General
Howard, who with the 11th corps was in position on the extreme
right of our army. Part of his line faced toward the south, and a part
to the west toward the Wilderness church. Chancellorsville is on the
verge of the Wilderness, where the great battles of the following
year were fought.
It appears that the reason our brigade was sent to Dowdell's tavern,
far from the rest of the division, was because General Birney had
received an order to send a brigade to General Howard to
strengthen his line. Howard deemed himself strong enough to hold
his line, so he returned our brigade with compliments to General
Birney.
Howard's line, as far as we could see, was not in the position that
we generally put ourselves, when in the face of the enemy. His men
on the right of the plank road were on open ground with pickets but
a short distance in front, and with arms stacked and accoutrements
hanging on the guns. The men were lounging about, some cooking,
and others playing cards. From all reports they were in similar shape
the next evening when they were routed by Jackson's onset.
When we got back to the division we found it massed in a large field
south of the plank road and a few rods west of Hooker's
headquarters. A section of rebel artillery opened on us here, but
their aim was bad and they did but little damage. A party of
sharpshooters was sent against them and caused them to withdraw
their guns.
We remained in this field until about 5 o'clock next morning, when
the division moved out the plank road toward the west, when after
we had gone about a mile we turned to the left and marched for
several hundred rods through a dense wood of small pines, on the
farther edge of which was a slight line of works which had been built
by troops which we relieved. These works we strengthened and in a
short time we had constructed a formidable line of breastworks. We
faced southward, the country in our front was open, and we had a
good view of the surrounding territory.
About noon we could see far in the distance, a rebel wagon train
and troops moving, and as at the point where we discovered them
they were going south, the general opinion was that they were
retreating towards Gordonsville. Clark's battery of rifled guns,
attached to our division, soon got into position and opened on the
rebel column, which, it was plain to see, caused considerable
commotion among them. They hurried past the point as rapidly as
possible, and were soon lost to view.
A detachment of Berdan's sharpshooters and the 20th Indiana were
sent out as skirmishers, and soon reached Welford's furnace, where
they captured several hundred men of the 23d Georgia and sent
them to the rear. The pioneers were sent out to build bridges across
a small creek in our front and when these were completed our
division moved forward toward the point where we had seen the
enemy. Whipple's 3d division of our corps moved forward at the
same time on our left and Barlow's brigade of the 11th corps moved
with us on our right. Marching up into the woods, considerable time
was taken up in forming into line of battle, and it was near sundown
before it was accomplished. The position of the 57th was along a rail
fence on the brow of a hill overlooking the little valley in which stood
the old furnace.
Just as we were about to advance a furious cannonade was heard
far in our rear in the direction of the plank road. This, as it proved,
was caused by Jackson's assault on the 11th corps, where
inadequate preparations were made for resisting such an onset, and
the whole corps was soon streaming to the rear.
At dark we received orders to fall in as quietly as possible, when we
were marched back by way we had come and halted in the little field
in front of the breastworks we had left a few hours before. When the
rout of the 11th corps began Berry's (Hooker's old) division of our
corps, which was on the plank road, was ordered up to check the
enemy.
In this division was the 37th New York, a two-year regiment, one of
whose members, Jack Coleman, afterwards joined Company K, of
the 57th. He relates that at Chancellorsville one of the 11th corps
artillerymen was going to the rear on the run, and carrying on his
shoulder the sponge staff, used to sponge the gun and which is
generally called the "swab" by battery men. When asked by some of
the boys of the 37th New York what he was running for, he halted
long enough to reply, "Ach, mein Chesus, Schneider's battery ish all
gone but der schwap." He was evidently bound to hang on to some
of Uncle Sam's property at any rate.
While we were still in position near the old breast-works, Ward's
brigade of our division made a bayonet charge by moonlight, with
uncapped guns, into the woods in our front and drove the enemy
back far enough to enable us to get out in the morning.
Just at the dawn of day on May 3d, the rebel general, J. E. B.
Stewart, who was commanding Jackson's corps, was attempting to
straighten his line in the woods on his right. The rebels at that point
became aware that a large body of "yanks" were in the field in their
front. This was our brigade, which was getting ready to move to the
right to get on ground which was more advantageous to resist an
attack. Where we were, the left flank of the different regiments were
presented to the enemy, so we faced to the right and commenced to
move briskly when the rebel skirmishers opened fire on us, but we
continued on the double quick until we reached the large field south
of the Chancellor house, where we deployed and formed line of
battle awaiting the onset of the enemy, and we did not have long to
wait, either.
We entered a wood in our front, with the 63d Pennsylvania on the
right of our regiment and the 68th on our left. There our men did
some very hard fighting. At one time we made a charge and drove
the enemy from a log breastwork, but the woods seemed to swarm
with the enemy; they were reenforced and drove us back in turn. We
then went in further to the right and were engaged again.
The 3d corps had been fighting since 5 o'clock in the morning. It
was now near 10, when victory was almost in our grasp, as the
enemy had been punished severely, and a fresh brigade would have
decided the battle in our favor. General Sickles had repeatedly called
for reenforcements, which could have been spared from the large
body of troops which were unemployed in the rear, but General
Couch, who was in temporary command of the army, refused to take
the responsibility of weakening any other part of the line to
reenforce Sickles. General Hooker, while standing near a large pillar
of the Chancellor house which was hit by a shell, was struck by
some of the flying fragments. He was disabled for several hours,
during which time the command devolved on General Couch, who
was the senior general on the field.
About 2 o'clock our army took up a new line a short distance in the
rear, which covered the roads leading to Ely's and United States
fords. The open ground around the Chancellor house was
abandoned to the enemy, who by this time were nearly exhausted,
and much reduced by the severe losses they had met with.
While the fighting was going on at Chancellorsville, General
Sedgwick had crossed at Fredericksburg and drove the enemy from
the heights in the rear of the town and then advanced up the river
to assist Hooker. But several miles out of Fredericksburg the rebels
encountered him at Salem church, where after severe fighting
Sedgwick's corps (the 6th) was repulsed and recrossed the river at
Bank's ford.
Our new line at Chancellorsville was one of great strength, and could
almost be defended by the artillery alone, which in large batteries
had been posted at advantageous points commanding the
approaches of the enemy. They made several attempts against our
line during the 4th, but were always repulsed by the artillery, which
was ably handled. In the evening that part of the line held by our
brigade was heavily shelled by the enemy, but most of their shells
passed over us and burst in the woods in our rear.
On the 5th it began to rain and rained all night, raising the
Rappahannock so high that our pontoon bridges were in danger of
being swept away. One of them had to be taken up to splice out the
other two, and it was only by the unremitting labor of the engineer
corps that the bridges were held in position.
On the morning of the 6th, after daylight, we commenced our
retreat unmolested by the enemy, and recrossed the river at United
States ford, and, after plodding all day through the mud and rain,
we regained our old camps about 6 o'clock in the evening.
The losses of the two armies were nearly equal, though the rebel
loss in killed was greater than ours. The Union loss was 1,612 killed,
9,591 wounded. The rebel loss was 1,665 killed and 9,081 wounded.
A severe loss to the enemy was the mortal wounding of Stonewall
Jackson. The losses in the 3d corps were very heavy, among them
two general officers, Generals Berry and Whipple, killed.
According to the monthly return of the 57th, dated April 30, 1863,
we find that the strength of the regiment present for duty was 24
officers and 232 enlisted men; total, 256. Our loss at the battle of
Chancellorsville was 2 officers and 8 men killed; 2 officers and 41
men wounded; 2 officers and 17 men captured. The officers killed
were Capt. Edson J. Rice and Lieut. Joseph Brady, Chaplain McAdam
and Assistant Surgeon Leet were captured, but being
noncombatants they were exchanged a few weeks afterward.
The battle of Chancellorsville ought to have ended in a victory for us,
and no doubt would have done so, had General Howard taken
proper precautions to prevent surprise on his part of the line. But it
seems the fates were against us. The cavalry expedition under
General Stoneman, of which much was expected, did but slight
damage to the enemy's railroads, and returned to our lines having
accomplished little or nothing.
CHAPTER VIII.
BY E. C. STROUSS.

Back Again in Our Old Camp—Cavalry Battle at Brandy Station—The March to


Gettysburg—Hooker's Request for Troops at Harper's Ferry—Asks to be
Relieved from the Command of the Army—We Arrive at Gettysburg—Battle of
July 2d—Strength of the Fifty-Seventh—Its Losses—General Graham Wounded
and Captured—Wounding of General Sickles—Battle of July 3d—July 4th—The
Confederates Retreat—General Sickles Asks for a Court of Inquiry—President
Lincoln to Sickles—A Visit to the Battlefield Twenty-five Years Later.

Although some of our men had destroyed their huts, when we


started on the recent campaign, there were on account of our
losses, enough still standing to shelter what was left of the regiment.
It was sad to look around at the vacant huts, and to realize that
their former occupants would never rejoin us. The 141st
Pennsylvania, whose camp adjoined ours, had met with severe
losses in the late battle and the large number of unoccupied huts in
their camp had a depressing effect on the spectator.
After a few days' rest the same old routine of drill, inspection, guard
and picket duty was resumed, relieved occasionally by a division or
corps review. The paymaster arrived on May 11th and paid the
regiment, each man receiving four months' pay, which to the private
soldier meant $52.00.
About the last week in May we abandoned our old camp for a new
location near Belle Plain landing, which was a depot of supplies on
the Potomac. The camp was soon laid out, and the weather having
become quite warm we needed only our little shelter tents to protect
us from the sun or rain. The camp of the regiment was near a road
leading to the landing, which was constantly occupied by teams
going to, or coming from there, which raised great clouds of dust, to
our great annoyance.
Our cavalry had quite a battle with the enemy at Brandy Station,
which ended favorably for us, and also made it obvious that the
rebels were moving northward, thus taking the initiative in what
became known as the "Gettysburg Campaign."
On June 11th, about noon, we were ordered to strike tents, and
were soon on the march, over the hills, and through the ravines of
Stafford county, which were no longer to be used by us as camping
grounds. The day was very warm and there was considerable
straggling, but the men all got up by night, when we camped at
Hartwood church. On the 12th we marched to near Bealeton station,
on the old Orange & Alexandria railroad, where we halted for the
night, and next day marched for a few miles toward Rappanhannock
station. On the 14th we started in the evening and marched
northward to Catlett station, where we arrived about midnight. On
the 15th we moved to Manassas Junction. This was one of the
hottest days of the season, and some forty men of our division were
prostrated by sunstroke. On the 16th, which was another hot and
dusty day, we marched to Bull Run and encamped at Mitchell's ford.
On the 17th we continued our march to Centerville, where we
remained until the evening of the 19th, when we started for Gum
Springs. After we had gone about two miles a violent storm of rain
set in. This was one of the worst night marches we ever made. The
night was dark as pitch, only an occasional flash of lightning to show
us the way. When we halted for the night we were drenched to the
skin and as our matches were all damp we had hard work to start
our campfires. When we had got our fires started we found that the
regiment must move a mile further on to go on picket. This was very
discomforting, but it had to be done, for such is the life of a soldier.
In the meantime the enemy had been moving northward on the
west side of the Blue Ridge mountains. A Union force under General
Milroy of about seven thousand men was attacked by the rebel
General Ewell, who captured many of them and drove the rest
across the Potomac. This occurred on the 13th and 14th of June.
On June 25th, the 57th with the rest of the 3d corps moved from
Gum Springs and crossed the Potomac at Edwards ferry into
Maryland and moved up the river to the mouth of the Monocacy
river.
The corps of Hill and Longstreet of Lee's army crossed the Potomac
at Williamsport and Sheppardstown and moved toward Pennsylvania.
They were preceded for several days by Ewell, who was now in that
state and threatening Harrisburg.
On June 26th we left our camp at the mouth of the Monocacy and
moved to Point of Rocks, on the Baltimore & Ohio railroad. The next
day we marched by way of Jefferson to Middletown, Md., and on the
28th to Woodsborough. There we learned that General Hooker had
been relieved from command of the army and had been succeeded
by Gen. George G. Meade. Hooker had asked Halleck, the general-in-
chief of the army, for the forces at Harpers Ferry and Baltimore
which were refused him, whereupon he asked to be relieved from
command. A few days later Meade asked for the same troops, some
thirteen thousand in number, and his request was complied with.
The change of commanders on the eve of battle was a questionable
thing, but as we were successful in the coming conflict, not much
was said about it.
Hooker's army had been depleted after Chancellorsville, by the
muster out of about thirty thousand two years or nine months men.
He was perfectly right in asking for the troops at Harpers Ferry,
which were doing no good there, but on account of an ill feeling
existing between Halleck and Hooker they were refused him,
although they were given to Meade. To a great many old soldiers it
was always a puzzle what Halleck was kept at Washington for
anyway.
It now became evident to the men of the 57th that we would soon
be called to fight a battle on the soil of our native state, but where
the battle ground would be was as yet a matter of conjecture.
On June 29th we marched from Woodborough to Taneytown and
encamped in a fine grove near the town. Many of the citizens of the
town, including a goodly lot of ladies visited our camp in the evening
and watched with interest the men putting up their tents, and
cooking their coffee. The next day we marched but a few miles, and
encamped at Bridgeport, a small hamlet about half way between
Taneytown and Emmitsburg, Md.
At 2 o'clock p. m. of July 1st we were hurriedly ordered to "fall in,"
when we took the Emmitsburg pike and rapidly marched toward
Gettysburg, twelve miles distant. The day was very warm and sultry,
but after a fatiguing march we arrived near the town about 8 p. m.,
and bivouacked for the night on the Trostle farm, which is located
about two miles south of Gettysburg. There had been severe fighting
going on north and west of the town from 10 a. m. until dark. The
1st and 11th corps had been engaged with overpowering numbers
of the enemy, and although they fought valorously, and met with
heavy losses, they were obliged to fall back through the town and
take up a stronger position on Cemetery hill. General Reynolds, who
commanded the Union forces engaged, was killed early in the fight.
His loss was deeply regretted, as he was one of the best generals in
our army. During the night all the other corps of our army came up
with the exception of the 6th corps, which having the greatest
distance to march did not arrive until 2 p. m. of the 2d. The men of
the 57th were up by daylight on the 2d and preparing their breakfast
and otherwise getting ready for the conflict which all knew would
open sooner or later during the day.
Unlike the battlefields of Virginia where we usually fought in the
woods or thickets, we were now on a field where we had an
unobstructed view, and could see something of the movements of
other troops, besides our own regiment or brigade.
At this time the 3d corps consisted of two divisions commanded by
Generals Birney and Humphreys. The right of the latter division
joined the left of Hancock's 2d corps on the southern slope of
Cemetery hill. Birney to the left was to extend his line on the same
prolongation to the base of Little Roundtop. But this line was
commanded by the high ground ground along the Emmitsburg road
and at the peach orchard. General Sickles, after having repeatedly
informed General Meade that the line was a weak one, assumed the
responsibility of changing it. He therefore posted Birney's division as
follows: Graham's brigade on the right, its right resting a few rods
north of the Sherfy house on the Emmitsburg road. At the peach
orchard, which is a part of the Sherfy farm, an angle was formed in
our brigade line, part of it facing west, and part to the south. On
Graham's left was De Trobriand's brigade which in part occupied the
wheatfield. Ward's brigade held the left of the division passing
through the rocky ground called Devil's Den, with his left resting at
the western base of Little Roundtop.
A great part of the day was spent by the maneuvering of both
armies. General Meade's opinion was that Lee would attack his right,
while that general was moving his troops behind Seminary ridge for
the purpose of attacking Meade's left. The key point on this part of
the line was Little Roundtop, but strange to tell, it was not occupied
by our troops until after the battle began and then just in the nick of
time. A few minutes later the enemy would have gained the crest
and Gettysburg would have been lost. The occupation of the hill is
due to the energy of General Warren, chief of engineers, who
succeeded in getting troops there just as the enemy was beginning
to ascend the western base of the hill.
In the meantime our regiment was lying in a field a few rods in the
rear of the Sherfy house, which stood on the opposite side of the
road. The 105th Pennsylvania was on our right, and the 114th on
our left. For two hours we lay here under the hottest fire of artillery
we had as yet been subjected to. The enemy had some thirty pieces
of artillery planted on the ridge to the south and west of us, hurling
their missiles toward us as fast as they could work their guns.
Fortunately most of them were aimed too high to do us injury, but to
stay there so long under that howling, shrieking storm of shot and
shell, was more trying to the nerves than to be engaged in close
action with the enemy.
Finally this long cannonade ceased and the enemy began to advance
his infantry to attack our part of the line. The 57th and the 114th
were ordered across the road, where we beheld the enemy, which
proved to be Barksdale's Mississippi brigade, advancing through the
fields toward us. Our regiment at once took advantage of the cover
that the house, outbuildings and trees afforded and opened fire on
the enemy, who were within easy range, and did not reply to our fire
until they reached a rail fence about a hundred yards in our front.
There were then no rebels to the right of those engaged with us,
and for a while we had the best of the fight owing to our sheltered
position. The men of the 57th who were in the house kept up a
steady fire from the west windows of the house. The writer had
posted himself by a large cherry tree against which some fenceposts
were leaning, on the north side of the house. Before the fight closed
this cherry tree was struck with a twelve pound solid shot from one
of our guns. When the monument of the regiment was dedicated in
July, twenty-five years later, the tree with the cannon ball embedded
in it was still standing.
Although the angle of the peach orchard was long and bravely
defended by our troops there, they were at last compelled to yield
ground, and by so doing the regiments along the Emmittsburg road
were enfiladed and obliged to fall back also. When we found the
enemy coming up the road in our rear, Captain Nelson, who was in
command of the regiment, tried to notify those in the house, and
order them to fall back, but amid the noise and confusion it was
impossible to make then understand the situation, and they kept on
firing from the windows after the rest of the men fell back, and they
were summoned to surrender by the rebels who came up the stairs
in their rear.
Those of us who got out of this tight place were soon after formed
with the rest of our division, on a ridge in the rear of the position we
had occupied in the morning. Reenforcements from the 5th, 2d and
12th corps were sent in to reestablish the line which our division had
held, but they were unable to do so when darkness put an end to
the conflict.
The 57th entered the battle with 18 officers and 187 enlisted men.
Our losses were 2 officers and 9 men killed, 9 officers and 37 men
wounded, and 4 officers and 55 men captured, a total of 116, over
half of the number carried into action. Lieutenant Henry Mitchell, of
Company E, and Lieutenant John F. Cox, of Company I, were killed,
and Colonel Sides was among the officers wounded. Of the 55
enlisted men captured only 11 returned to the regiment. The
remaining 44 died in prison at Belle Isle, or at Andersonville. Major
Neeper was captured, as were also Lieutenants Hines, Burns and
Crossley.
General Graham was wounded and taken prisoner in the peach
orchard. General Sickles lost a leg near the Trostle house about 6 p.
m. General Birney then assumed command of the corps. Col. A. H.
Tippon, of the 68th Pennsylvania, succeeded General Graham in
command of the brigade.
Early in the morning of the 3d our division was ordered to the front,
which was now considerably in rear of the position we occupied the
day before. The enemy occupied the Emmitsburg road and the
peach orchard, and fields to the south. On the left near the
Roundtops their line was farther back than the position they gained
the evening before. From the position of our regiment we could
plainly see the Sherfy house, which was about three-fourths of a
mile to our front and left.
When General Geary, with part of his division, on the 2d left his
position on the right of the Union line at Culp's hill to reenforce the
3d corps, he left behind him to hold his works the brigade of General
Greene. The enemy in the evening in strong force attacked this
position and succeeded in capturing a part of the line of works, but
they were recaptured by General Geary early next morning.
In front of the 57th everything was quiet and the men were enjoying
a much needed rest under the trees in the little grove in which they
were stationed. Rations were distributed and we also received a
good ration of commissary whiskey, which at that time was duly
appreciated. It was quiet during the forenoon and many of our men,
pillowed on their knapsacks, were asleep when the tremendous
artillery fire began which was the prelude to the charge of Pickett's
division on Hancock's position on Cemetery hill. Their fire was soon
responded to by our artillery and for about two hours the earth fairly
shook with the thunder of these guns and the bursting of shells. All
this noise was going on about a mile to the right of us and as we
were "not in it" we were anxiously wondering what the result would
be.
After this cannonading had been going on for some time we were
ordered to fall in quickly. About eighty of the 57th were left to
respond to the call. These were soon in line and with the rest of the
brigade we moved rapidly to the right in the direction of the firing.
Moving in double quick for about a mile we were halted and took a
position a few rods in rear of several batteries which were heavily
engaged. They had just repulsed a charge of Wilcox's rebel brigade,
which was supporting Pickett on his right, and whose retreat was
being covered by the rebel artillery. We did not become engaged
while here, but were exposed to the enemy's fire, which, however,
did us no harm. After the firing ceased and the smoke had lifted, we
learned of the repulse of Pickett's men and that our army had for
once gained an important victory.
That night the regiment was sent on picket duty about half a mile to
our front on ground that had been fought over on the afternoon of
the 2d, and as the bodies of dead men and horses strewed the
ground, the hot sun had decomposed them, causing an odor that
was extremely disagreeable.
At daylight we moved back and rejoined the brigade. It was the 4th
of July, the eighty-seventh anniversary of American Independence,
and here we were on a field strewn with the bodies of our comrades,
who had died for the great principles which our fathers had
maintained in 1776. With the exception of a little picket firing there
was no fighting on the 4th, and that night the enemy began their
retreat back to Virginia.
General Sickles has been blamed in some quarters for taking the
advanced position he did at Gettysburg on July 2d, but he is also
sustained by many prominent military men, among them Gen. U. S.
Grant, who visited the battlefield after the war.
The enemy having retreated, the 6th corps and cavalry were sent in
pursuit. Our corps did not leave until the 7th. On the afternoon of
the 6th the writer took a stroll out to the Sherfy house to look at the
ground there. At the house the brick walls on the south and west
sides were scarred by the enemy's bullets and the roof had a
number of holes made by fragments of shell. The bursting of shells
had set fire to the large barn and destroyed it, burning at the same
time a number of wounded soldiers who had sought refuge in it. The
dead had all been buried, but where our batteries had stood were
heaps of dead horses. It was then I discovered the cannon ball in
the cherry tree, mentioned above, by which I had been standing
during the fight on the 2d. The ball was from our own guns, and no
doubt struck the tree during the fighting of July 3d, or on the
afternoon of the 2d after our men had abandoned the house.
While visiting the battlefields in 1888 Mrs. Sherfy informed me that
nothing worth mentioning had been taken from the house or
destroyed. An eight-day clock, which had been wound up before the
family left the house when a battle was imminent, was still ticking
away when they returned after the fight was over. She also stated
that a limber chest containing a lot of ammunition was found in the
field opposite the house. The men of the family were afraid to
handle the ammunition, so to dispose of it, they dug a hole beside
the chest, and tumbled it in, contents and all, and covered it up, and
it had not been disturbed since. The chest no doubt belonged to
Randolph's battery, as a section of it was in action at the point
indicated by Mrs. Sherfy.
CHAPTER IX.
BY E. C. STROUSS.

We Leave Gettysburg—Rebel Spy Hung—French's Division Joins the 3d Corps


—Enemy's Position at Falling Waters—He Escapes Across the Potomac—In Old
Virginia Again—Manassas Gap—Camp at Sulphur Springs—Movement to
Culpepper—Eleventh and Twelfth Corps Sent West—Lee's Efforts to Gain Our
Rear—Skirmish at Auburn Creek—Warren's Fight at Bristow Station—Deserter
Shot—Retreat of the Enemy—Kelly's Ford—Mine Run Campaign—The
Regiment Re-enlists—The "Veteran Furlough"—Recruiting—Presented with a
New Flag by Governor Curtin—Back to the Front—General Grant Commands
the Army—Reorganization—The Wilderness Campaign—Three Days of Hard
Fighting—Loss in Fifty-Seventh.

On the morning of July 7th we left Gettysburg and moved


southward, through Emmitsburg and halted for the night at
Mechanicstown, Md. On the 8th we passed Frederick City, and
encamped two miles beyond the town. While passing the town we
could see away off to our right near the town a gallows standing,
and a large crowd gathered about it. A rebel spy had been caught
and hung. Some of our men who saw this spy, recognized in him the
same man who sold and sang songs throughout our camp the
summer before when we lay in front of Richmond. He was a fine
singer and sold lots of his songs, but he met the fate of a spy at last.
On the 9th we moved again and at night we reached South
Mountain.
About this time the division of Gen. W. H. French was assigned to
our corps and became the 3d division. General French being the
senior general, now took command of the corps. Colonel Tippon had
been relieved from the command of the brigade, which was now
commanded by Colonel Madill, of the 141st Pennsylvania.
On July 10th we marched from South Mountain to a point about five
miles beyond Keedysville, Md. On the 12th we were drawn up in line
of battle near Falling Waters, and expected to attack the enemy, who
had thrown up a strong line of works to cover their crossing of the
Potomac. The attack, however, was delayed too long, and when we
advanced on the 14th we found their works deserted and the enemy
safely across the river. Previous to this many of their wagons had
been captured and many prisoners taken by our cavalry.

Monument and group of survivors of the Regiment

It was humiliating to think that the enemy escaped so easily. With


the swollen Potomac in their front, their pontoon bridge destroyed,
and our victorious army in their rear, they ought to have been
compelled to surrender. But Appomattox was still a long way off and
many brave boys would fall before the end came. The news that
General Grant had taken Vicksburg, and caused the surrender of
Pemberton's army, was some consolation in our disappointment over
Lee's escape.
On the 15th we passed over the old Antietam battlefield, and halted
for the night about two miles beyond Sharpsburg. On the 16th we
passed through Brownsville and Rohrersville and encamped near
Harper's Ferry. The next day about dark we crossed the Potomac at
Harper's Ferry and were once more on the soil of Virginia.
We resumed our march on the 18th and 19th, and on the 20th we
reached Upperville. On the 23d we were near Manassas Gap, where
it was expected we would strike the enemy's column, which was
moving up the Shenandoah valley. We moved to the top of a high
hill, where we had a fine view of Front Royal and the surrounding
country. We also witnessed a fight in a field in the valley to our right,
of a force of the enemy and Sickles' old Excelsior brigade. This
engagement, in which we were but slightly engaged, is known as
the skirmish of "Wapping Heights." The enemy retreated during the
night and next day we moved some miles beyond Piedmont on the
Manassas Gap railroad. The greater part of our march was over the
torn up railroad track, and as the day was excessively hot we were a
tired lot of men when we encamped that night.
On the 25th we marched to within six miles of Warrenton, in
Fauquier county, Va. The next day we moved four miles beyond the
town and encamped at Fauqueir Sulphur Springs. Here we remained
for about six weeks, during which time Colonel Sides and some of
the officers and men who had been wounded at Chancellorsville and
Gettysburg returned for duty. Here we had a fine camp, with good
facilities for bathing in Hedgeman's river, a branch of the
Rappahannock. The large brick hotel at the springs had been
destroyed by fire the year before during Pope's campaign. Back of
the hotel site was a fine park which was surrounded on three sides
by cottages which had been used by summer sojourners at this
place. Near the center of the park stood a pavilion, under which was
the noted spring, the water of which was very cold and strongly
impregnated with sulphur. We drank freely of this water and were
advised to do so by the medical officers of the division. If we had
been afflicted with the itch, the water would no doubt have been an
effective remedy, but the only itch that troubled us was caused by a
small insect known among scientists as the pediculus vestimenti and
the sulphur water was not effective in driving the pests away.
Our camp at the spring was broken up on the afternoon of
September 15th, when we moved southward to Freeman's ford,
where we crossed the Rappahannock and took up a position
between Culpepper and Stone House mountain. The whole army
was now in position between the rivers Rappahannock and the
Rapidan.
About the end of September the 11th and 12th corps were detached
from the Army of the Potomac and under General Hooker were sent
to the west to reenforce our army operating around Chattanooga,
Tenn. Longstreet's corps of the rebel army had previously been sent
to the same point to reenforce General Bragg.
We remained in the vicinity of Culpepper until October 12th, when it
was found that Lee's army had crossed the Rapidan and was turning
our right. This caused a retrograde movement of our whole army.
Our division moved to the rear on October 11th, the 57th acting as
flankers on the left of the column. At one point, when on a high hill,
we had a fine view of a cavalry battle which was going on in our rear
near Brandy Station. In the evening we crossed the Rappahannock
at Freeman's ford and halted for the night in a pine woods. On the
morning of the 12th we learned that the enemy had driven back our
cavalry, and was crossing the river at our old camp at Sulphur
Springs, about three miles above us. Our march to the rear
continued on a by-road which brought us to the Warrenton branch
of the O. & A. R. R. about three miles east of Warrenton. We rested
here for a while and then after a march of about five miles further
we halted for the night.
About 4 p. m. on the 13th we encountered the enemy's cavalry at
Auburn creek. Our brigade held the advance of the column on this
day, and the 57th was the leading regiment. Companies A and K
acted as advance guard. These companies deployed on both sides of
the road and opened fire on the rebels, who were dismounted and
advancing through the woods and fields. Our firing soon brought up
the rest of the brigade and a battery, whereupon, the rebels seeing
we were well supported, mounted their horses and retreated at a
lively gait. Several men of our regiment were slightly wounded in
this affair. When the skirmish was over we resumed our march, and
about dark we reached the English settlement called Greenwich,
where we encamped, and our regiment was posted as pickets.
We started again next morning and moved to Centerville, via Bristow
and Manassas Junction. Late in the afternoon, the 2d corps, under
General Warren, acting as rear guard, had a severe battle with Hill's
corps, in which Warren was victorious, capturing a battery, several
battle flags, and about four hundred prisoners.
On the 15th we moved to Fairfax Station and here on the following
day, our regiment for the first time witnessed the solemn spectacle
of a military execution. A private of the 5th Michigan who had
deserted to the enemy and had been recaptured, was shot for
desertion.
In the late movements, General Lee's object was to gain our rear
and cut us off from Washington, but when we reached the strong
position on the heights of Centerville, he found he was foiled, and
then it became his turn to retreat. He was followed by our cavalry
and several brisk skirmishes took place between our troopers and
the enemy.
On the 19th our division was again moving, this time with our faces
toward the Rappahannock, and at night we encamped near Bristow
station. On the 20th we marched through Greenwich and encamped
two miles beyond the town. On the 21st we passed through Auburn,
and over the ground where Gen. Alex. Hay's division of the 2d corps
had engaged the enemy a few days before, and at night we
encamped near Catlett's station. From this date until November 7th
we moved to various points along the railroad, which having been
destroyed by the enemy, made it necessary for us to rebuild it,
consequently our advance was slow.
Near Warrenton Junction, at 5 a. m. on November 5th we broke
camp and moved to Kelly's ford on the Rappahannock. Here our
crossing was disputed by the enemy and a brisk skirmish ensued.
They finally relinquished their attempts to hold the ford when we
crossed over and encamped about dark. In this skirmish, while Capt.
T. L. Maynard, our brigade inspector, was giving a drink of water to a
wounded rebel, he was mortally wounded and died next morning.
While we were fighting at Kelly's ford, the 5th and 6th corps had a
fight with the enemy, whom they drove out of their works at
Rappahannock station, about eight miles above Kelly's ford.
On the 8th we reached Brandy Station and after a few days we
moved into the woods near James Barbour's house, and occupied a
lot of huts, which had lately been constructed by the rebels, to be
used as winter quarters, but they had now fallen back beyond the
Rapidan river. We remained in this camp for a few weeks and then
were once more on the move to take part in what is known as the
"Mine Run campaign."
On the morning of November 26th we moved out of camp, and in
the evening crossed the Rapidan at Jacobs' ford, without interruption
from the enemy. The advance was resumed next morning and about
4 p. m. our division was hurried to the front to relieve the 3d
division, which had become engaged with Johnson's division of
Ewell's corps. We got into a brisk little fight in which the 57th had
seven wounded. This action occurred near Locust Grove. It appears
that our corps commander, General French, had been instructed to
move on a road which would have led him between the corps of Hill
and Ewell, who were miles apart, but he got on the wrong road and
ran against the corps of Ewell, which brought on the engagement.
The enemy retreated during the night and the next morning their
army was concentrated, which our movements the day before were
intended to prevent.
On the 28th we started again and after marching all day in the rain
we came up with the enemy, who were occupying a strong position
near the western bank of Mine run. This stream, flowing north, is
deep and sluggish, with steep banks, and empties into the Rapidan
at Mitchell's ford.
On the 29th the regiment lay in rear of a battery as a support, and
at night a part of the regiment was sent out to the run to support
the picket line. It was bitter cold, and we were allowed no fires, so
we had a very uncomfortable night of it.
General Warren, with the 2d corps, held the extreme left of the line,
and he thought that he could carry the enemy's position in his front,
if strongly reenforced. Early in the morning one division of the 6th
corps, and the 2d and 3d divisions of the 3d corps were sent him.
We of Birney's division were in the center, posted along the brow of
a hill with the enemy behind breastworks about three-fourths of a
mile in our front. We were to hold ourselves in readiness, upon
hearing the sound of Warren's guns, to charge the enemy's works.
Warren, upon further examination of the enemy's lines, informed
General Meade that the enemy's lines were too strong to hazard an
attack. We were not sorry when we heard this, for it would have
been extremely perilous to have charged over the broad open field
in our front up to the enemy's works.
On December 1st a snow storm set in, and after dark we marched to
the rear, and recrossed the Rapidan at Culpepper ford about daylight
on the 2d. About 9 o'clock our march was resumed, the 57th and the
63d Pennsylvania acting as wagon guard to our long train. Having
run out of rations we were very hungry, but we contrived to get
something to eat before night. On December 3d we reached our old
camps, and finding our huts still standing, we soon had them roofed,
and were again comfortably housed.
A few days after we got settled down, the question of reenlistment
was much discussed among the men. The War Department had
issued General Order No. 191, which allowed every man who
reenlisted a bounty of $400.00 (to be paid in installments) and a
furlough for thirty days. Before leaving on furlough each man was to
be paid $100.00, under the bounty act of July 22, 1861, one month's
pay in advance, $13.00, premium, $2.00, and first installment of
bounty under General Order 191, $60.00, making a total of $175.00.
Where three-fourths of the men present for duty in a regiment
reenlisted, the regiment was allowed to go in a body with their arms
to place of organization, and from thence the men could go to their
homes on furlough. They were also entitled to be designated as
"veteran regiments," and each man was allowed to wear the veteran
stripes on the sleeves of his coat.
On the 24th of December the regiment was formed in a hollow
square in front of headquarters, and was then briefly addressed by
Chaplain McAdam on the propriety of reenlisting. At the conclusion
of the chaplain's remarks, Colonel Sides requested those who were
willing to reenlist, to step three paces to the front. Over three-
fourths of the men stepped forward, and, after giving three hearty
cheers for the Union, were dismissed. Then for several days the
officers and first sergeants were busy making out muster rolls,
furloughs, and reenlistment papers.
Among the men the furlough was the all-absorbing theme. When
were they to be granted? It is safe to say that a bounty of
$1,000.00, without the furlough, would have secured but a small
number of the men. But the assurance of spending thirty days at
home was the great inducement for reenlisting, as most of the men
had been absent from home for two years or more.
January 8th, 1864, was the time appointed for the regiment to
depart for the north, and long before daylight the boys were up and
getting ready for their departure. The men who had not reenlisted
were temporarily assigned to the 141st Pennsylvania. At 7 o'clock a.
m., in the midst of a snow storm, we boarded a train at Brandy
station and were soon on our way to Washington, where we
remained for a day and a night, and then started for Harrisburg.
Here we deposited our arms and accoutrements in the arsenal, and
then the men departed by different routes for their homes.
Our stay at home was one continual round of pleasure. There were
parties, festivals and sleigh-rides without number and the men will
never forget those halcyon days of our "veteran furlough."
After the men had been at home for some days, many of their
friends were anxious to enlist and return with them to the army. On
account of our success in obtaining recruits our furlough was
extended. When we left for home the regiment numbered barely two
hundred men. After an absence of forty-five days we returned with
nearly five hundred men in our ranks.
Our old flag which had been torn by the bullets of many battles was
left at Harrisburg while we were on furlough, and when we returned
to the front we received a new one, with an appropriate speech,
from the hands of Governor Curtin.
On the 25th of February we rejoined our old brigade near Culpepper,
Va., and on the 27th we went with the division on a reconnaissance
to James City. We were gone two days, during which time nothing of
importance occurred.
General Grant, having been appointed lieutenant-general, and placed
in command of all our armies, made his headquarters with the Army
of the Potomac some time in March, 1864. About the 16th of March
the army was reorganized, the 1st and 3d corps were disbanded and
the divisions assigned to other corps. The 1st and 2d division of the
3d corps (the old divisions of Kearny and Hooker) were assigned to
the 2d corps, commanded by General Hancock. The 3d division was
assigned to the 6th corps. Our division, now designated as the 3d
division, of the 2d corps, was commanded by General Birney. It
consisted of two brigades commanded by Generals Ward and Hays.
Our brigade (now designated as the 2d brigade, 3d division, 2d
corps) was commanded by Gen. Alexander Hays and was comprised
of the following named regiments: 4th and 17th Maine; 3d and 5th
Michigan; 93d New York; 57th, 63d and 105th Pennsylvania, and 1st
United States Sharpshooters. The 68th and 114th Pennsylvania of
our old brigade were detached, and acted as provost guard at army
headquarters. The 141st Pennsylvania was attached to Ward's
brigade.
The men were proud of the record of the army corps to which they
had formerly belonged, and felt very glad to know that they would
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

textbookfull.com

You might also like