100% found this document useful (1 vote)
16 views

Agile Web Development with Rails 4th edition Beta 10 version Sam Ruby - The ebook is ready for instant download and access

The document provides information on downloading the 'Agile Web Development with Rails 4th edition Beta' by Sam Ruby, along with links to additional related ebooks and textbooks. It highlights that the book is in beta form, meaning it may contain errors and is still under development. Readers are encouraged to provide feedback and will receive updates as the book progresses towards its final version.

Uploaded by

livenoetable
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
100% found this document useful (1 vote)
16 views

Agile Web Development with Rails 4th edition Beta 10 version Sam Ruby - The ebook is ready for instant download and access

The document provides information on downloading the 'Agile Web Development with Rails 4th edition Beta' by Sam Ruby, along with links to additional related ebooks and textbooks. It highlights that the book is in beta form, meaning it may contain errors and is still under development. Readers are encouraged to provide feedback and will receive updates as the book progresses towards its final version.

Uploaded by

livenoetable
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/ 51

Visit https://ebookultra.

com to download the full version and


explore more ebooks or textbooks

Agile Web Development with Rails 4th edition Beta


10 version Sam Ruby

_____ Click the link below to download _____


https://ebookultra.com/download/agile-web-development-with-
rails-4th-edition-beta-10-version-sam-ruby/

Explore and download more ebooks or textbooks at ebookultra.com


Here are some recommended products that we believe you will be
interested in. You can click the link to download.

Agile Web Development with Rails 5 1st Edition Sam Ruby

https://ebookultra.com/download/agile-web-development-with-
rails-5-1st-edition-sam-ruby/

Ruby on Rails Tutorial Learn Web Development with Rails


3rd Edition Michael Hartl

https://ebookultra.com/download/ruby-on-rails-tutorial-learn-web-
development-with-rails-3rd-edition-michael-hartl/

Build Your Own Ruby on Rails Web Applications 1st Edition


Patrick Lenz

https://ebookultra.com/download/build-your-own-ruby-on-rails-web-
applications-1st-edition-patrick-lenz/

Practical Reporting with Ruby and Rails 1st Edition David


Berube

https://ebookultra.com/download/practical-reporting-with-ruby-and-
rails-1st-edition-david-berube/
RailsSpace Building a Social Networking Website with Ruby
on Rails Addison Wesley Professional Ruby Series Hartl

https://ebookultra.com/download/railsspace-building-a-social-
networking-website-with-ruby-on-rails-addison-wesley-professional-
ruby-series-hartl/

Practical JRuby on Rails Web 2 0 projects bringing Ruby on


Rails to the Java platform 1st Edition Ola Bini

https://ebookultra.com/download/practical-jruby-on-rails-
web-2-0-projects-bringing-ruby-on-rails-to-the-java-platform-1st-
edition-ola-bini/

Pro Active Record Databases with Ruby and Rails 1st


Edition Kevin Marshall

https://ebookultra.com/download/pro-active-record-databases-with-ruby-
and-rails-1st-edition-kevin-marshall/

Ruby on Rails Background Jobs with Sidekiq 1 / converted


Edition David B. Copeland

https://ebookultra.com/download/ruby-on-rails-background-jobs-with-
sidekiq-1-converted-edition-david-b-copeland/

Ruby on Rails For Dummies 1st Edition Burd

https://ebookultra.com/download/ruby-on-rails-for-dummies-1st-edition-
burd/
Agile Web Development with Rails 4th edition Beta 10
version Sam Ruby Digital Instant Download
Author(s): Sam Ruby, Dave Thomas, David Heinemeier Hansson
ISBN(s): 9781934356548, 1934356549
Edition: Fourth Edition
File Details: PDF, 14.89 MB
Year: 2011
Language: english
Prepared exclusively for Anton Fonarev
Beta
Book
Agile publishing for agile developers

Under Construction The book you’re reading is still under development. As


part of our Beta book program, we’re releasing this copy well before a normal
book would be released. That way you’re able to get this content a couple of
months before it’s available in finished form, and we’ll get feedback to make
the book even better. The idea is that everyone wins!

Be warned. The book has not had a full technical edit, so it will contain
errors. It has not been copyedited, so it will be full of typos and other weird-
ness. And there’s been no effort spent doing layout, so you’ll find bad page
breaks, over-long lines with little black rectangles, incorrect hyphenations,
and all the other ugly things that you wouldn’t expect to see in a finished
book. We can’t be held liable if you use this book to try to create a spiffy
application and you somehow end up with a strangely shaped farm imple-
ment instead. Despite all this, we think you’ll enjoy it!

Download Updates Throughout this process you’ll be able to download


updated ebooks from your account on http://pragprog.com. When the book
is finally ready, you’ll get the final version (and subsequent updates) from the
same address.

Send us your feedback In the meantime, we’d appreciate you sending us


your feedback on this book at http://pragprog.com/titles/rails4/errata, or by using
the links at the bottom of each page.

Thank you for being part of the Pragmatic community!

Andy & Dave

Prepared exclusively for Anton Fonarev


Agile Web Development with Rails
Fourth Edition

Sam Ruby
Dave Thomas
David Heinemeier Hansson

Leon Breedt
with
Mike Clark
James Duncan Davidson
Justin Gehtland
Andreas Schwarz

The Pragmatic Bookshelf


Raleigh, North Carolina Dallas, Texas

Prepared exclusively for Anton Fonarev


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 Program-
mers, 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 Program-
ming, 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.

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://www.pragprog.com.

Copyright © 2010 The Pragmatic Programmers LLC.

All rights reserved.

No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any
form, or by any means, electronic, mechanical, photocopying, recording, or otherwise, without the
prior consent of the publisher.

Printed in the United States of America.

ISBN-10: 1-934356-54-9
ISBN-13: 978-1-934356-54-8
Printed on acid-free paper.
B10.0 printing, October 28, 2010
Version: 2010-10-28

Prepared exclusively for Anton Fonarev


Contents
Changes in the Beta Releases 10
Beta 10—October 28 . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Beta 9—October 6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Beta 8—September 9 . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Beta 7—August 25 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Beta 6—July 27 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Beta 5—June 28 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Beta 4—May 26 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Beta 3—May 11 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Beta 2—May 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

Preface to the Fourth Edition 14

Acknowledgements 16

Introduction 18
Rails Simply Feels Right . . . . . . . . . . . . . . . . . . . . . . . . . 18
Rails Is Agile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Who This Book Is For . . . . . . . . . . . . . . . . . . . . . . . . . . 21
How To Read This Book . . . . . . . . . . . . . . . . . . . . . . . . . 21

Part I—Getting Started 25

1 Installing Rails 26
1.1 Installing on Windows . . . . . . . . . . . . . . . . . . . . . . 26
1.2 Installing on Mac OS X . . . . . . . . . . . . . . . . . . . . . 28
1.3 Installing on Linux . . . . . . . . . . . . . . . . . . . . . . . . 29
1.4 Choosing a Rails Version . . . . . . . . . . . . . . . . . . . . 30
1.5 Setting Up Your Development Environment . . . . . . . . . 31
1.6 Rails and Databases . . . . . . . . . . . . . . . . . . . . . . . 35
1.7 What We Just Did . . . . . . . . . . . . . . . . . . . . . . . . 36

Prepared exclusively for Anton Fonarev


CONTENTS 6

2 Instant Gratification 37
2.1 Creating a New Application . . . . . . . . . . . . . . . . . . . 37
2.2 Hello, Rails! . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
2.3 Linking Pages Together . . . . . . . . . . . . . . . . . . . . . 46
2.4 What We Just Did . . . . . . . . . . . . . . . . . . . . . . . . 48

3 The Architecture of Rails Applications 50


3.1 Models, Views, and Controllers . . . . . . . . . . . . . . . . 50
3.2 Rails Model Support . . . . . . . . . . . . . . . . . . . . . . . 53
3.3 Action Pack: The View and Controller . . . . . . . . . . . . 55

4 Introduction to Ruby 57
4.1 Ruby Is an Object-Oriented Language . . . . . . . . . . . . 57
4.2 Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
4.3 Logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
4.4 Organizing Structures . . . . . . . . . . . . . . . . . . . . . . 65
4.5 Marshaling Objects . . . . . . . . . . . . . . . . . . . . . . . 68
4.6 Pulling It All Together . . . . . . . . . . . . . . . . . . . . . . 68
4.7 Ruby Idioms . . . . . . . . . . . . . . . . . . . . . . . . . . . 69

Part II—Building an Application 72

5 The Depot Application 73


5.1 Incremental Development . . . . . . . . . . . . . . . . . . . . 73
5.2 What Depot Does . . . . . . . . . . . . . . . . . . . . . . . . . 74
5.3 Let’s Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78

6 Task A: Creating the Application 80


6.1 Iteration A1: Creating the Products Maintenance Applica-
tion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
6.2 Iteration A2: Making Prettier Listings . . . . . . . . . . . . . 87

7 Task B: Validation and Unit Testing 94


7.1 Iteration B1: Validating! . . . . . . . . . . . . . . . . . . . . . 94
7.2 Iteration B2: Unit Testing of Models . . . . . . . . . . . . . 99

8 Task C: Catalog Display 108


8.1 Iteration C1: Creating the Catalog Listing . . . . . . . . . . 108
8.2 Iteration C2: Adding a Page Layout . . . . . . . . . . . . . . 111
8.3 Iteration C3: Using a Helper to Format the Price . . . . . . 115
8.4 Iteration C4: Functional Testing of Controllers . . . . . . . 115

Report erratum
Prepared exclusively for Anton Fonarev this copy is (B10.0 printing, October 28, 2010)
CONTENTS 7

9 Task D: Cart Creation 120


9.1 Iteration D1: Finding a Cart . . . . . . . . . . . . . . . . . . 120
9.2 Iteration D2: Connecting Products to Carts . . . . . . . . . 121
9.3 Iteration D3: Adding a Button . . . . . . . . . . . . . . . . . 123

10 Task E: A Smarter Cart 129


10.1 Iteration E1: Creating a Smarter Cart . . . . . . . . . . . . 129
10.2 Iteration E2: Handling Errors . . . . . . . . . . . . . . . . . 134
10.3 Iteration E3: Finishing the Cart . . . . . . . . . . . . . . . . 136

11 Task F: Add a Dash of Ajax 142


11.1 Iteration F1: Moving the Cart . . . . . . . . . . . . . . . . . 143
11.2 Iteration F2: Creating an Ajax-Based Cart . . . . . . . . . . 148
11.3 Iteration F3: Highlighting Changes . . . . . . . . . . . . . . 151
11.4 Iteration F4: Hiding an Empty Cart . . . . . . . . . . . . . . 153
11.5 Testing Ajax changes . . . . . . . . . . . . . . . . . . . . . . 156

12 Task G: Check Out! 161


12.1 Iteration G1: Capturing an Order . . . . . . . . . . . . . . . 161
12.2 Iteration G2: Atom Feeds . . . . . . . . . . . . . . . . . . . . 175
12.3 Iteration G3: Pagination . . . . . . . . . . . . . . . . . . . . . 179

13 Task H: Sending Mail 184


13.1 Iteration H1: Sending Confirmation E-mails . . . . . . . . . 184
13.2 Iteration H2: Integration Testing of Applications . . . . . . 191

14 Task I: Logging In 197


14.1 Iteration I1: Adding Users . . . . . . . . . . . . . . . . . . . 197
14.2 Iteration I2: Authenticating Users . . . . . . . . . . . . . . . 206
14.3 Iteration I3: Limiting Access . . . . . . . . . . . . . . . . . . 211
14.4 Iteration I4: Adding a Sidebar, More Administration . . . . 214

15 Task J: Internationalization 219


15.1 Iteration J1: Selecting the locale . . . . . . . . . . . . . . . . 220
15.2 Iteration J2: Translating the Store Front . . . . . . . . . . . 222
15.3 Iteration J3: Translating Checkout . . . . . . . . . . . . . . 229
15.4 Iteration J4: Add a Locale Switcher . . . . . . . . . . . . . . 235

16 Task K: Deployment and Production 239


16.1 Iteration K1: Deploying with Phusion Passenger and MySQL 241
16.2 Iteration K2: Deploying Remotely with Capistrano . . . . . 246
16.3 Iteration K3: Checking Up on a Deployed Application . . . 252

Report erratum
Prepared exclusively for Anton Fonarev this copy is (B10.0 printing, October 28, 2010)
CONTENTS 8

17 Depot Retrospective 256


17.1 Rails Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . 256
17.2 Documenting What We Have Done . . . . . . . . . . . . . . 259

Part III—Rails In Depth 261

18 Finding Your Way Around Rails 262


18.1 Where things go . . . . . . . . . . . . . . . . . . . . . . . . . 262
18.2 Naming Conventions . . . . . . . . . . . . . . . . . . . . . . 270

19 Active Record 275


19.1 Defining your Data . . . . . . . . . . . . . . . . . . . . . . . . 275
19.2 Locating and Traversing Records . . . . . . . . . . . . . . . 280
19.3 Creating, Reading, Updating, and Deleting (CRUD) . . . . 283
19.4 Participating in the Monitoring Process . . . . . . . . . . . 299
19.5 Transactions . . . . . . . . . . . . . . . . . . . . . . . . . . . 306

20 Action Dispatch and Action Controller 311


20.1 Dispatching Requests to Controllers . . . . . . . . . . . . . 311
20.2 Processing of Requests . . . . . . . . . . . . . . . . . . . . . 322
20.3 Objects and operations that span requests . . . . . . . . . 333

21 Action View 343


21.1 Using Templates . . . . . . . . . . . . . . . . . . . . . . . . . 343
21.2 Form Helpers . . . . . . . . . . . . . . . . . . . . . . . . . . . 345
21.3 Processing Forms . . . . . . . . . . . . . . . . . . . . . . . . 348
21.4 Uploading Files to Rails Applications . . . . . . . . . . . . . 350
21.5 Creating Your Own Helpers . . . . . . . . . . . . . . . . . . . 353
21.6 Reducing Maintenance with Layouts and Partials . . . . . 360

22 Caching 369
22.1 Page Caching . . . . . . . . . . . . . . . . . . . . . . . . . . . 369
22.2 Expiring Pages . . . . . . . . . . . . . . . . . . . . . . . . . . 372
22.3 Fragment Caching . . . . . . . . . . . . . . . . . . . . . . . . 378

23 Migrations 384
23.1 Creating and Running Migrations . . . . . . . . . . . . . . . 384
23.2 Anatomy of a Migration . . . . . . . . . . . . . . . . . . . . . 387
23.3 Managing Tables . . . . . . . . . . . . . . . . . . . . . . . . . 391
23.4 Advanced Migrations . . . . . . . . . . . . . . . . . . . . . . 395
23.5 When Migrations Go Bad . . . . . . . . . . . . . . . . . . . . 400
23.6 Schema Manipulation Outside Migrations . . . . . . . . . . 401

Report erratum
Prepared exclusively for Anton Fonarev this copy is (B10.0 printing, October 28, 2010)
CONTENTS 9

24 Non-Browser Applications 403


24.1 A Standalone Application Using Active Record . . . . . . . 403
24.2 A Library Function Using Active Support . . . . . . . . . . 404
24.3 A Remote Application Using Active Resource . . . . . . . . 409

25 Rails’ Dependencies 415


25.1 Generating XML with Builder . . . . . . . . . . . . . . . . . 415
25.2 Generating HTML with ERb . . . . . . . . . . . . . . . . . . 417
25.3 Managing Dependencies with Bundler . . . . . . . . . . . . 419
25.4 Interfacing with the web server with Rack . . . . . . . . . . 421
25.5 Automating Tasks with Rake . . . . . . . . . . . . . . . . . . 425
25.6 Survey of Rails’ Dependendencies . . . . . . . . . . . . . . . 426

26 Rails Plugins 430


26.1 Credit Card Processing with Active Merchant . . . . . . . . 430
26.2 Saving Bandwidth with Asset Packager . . . . . . . . . . . 432
26.3 Beautifying our Markup with Haml . . . . . . . . . . . . . . 434
26.4 Write Less and Do More with JQuery . . . . . . . . . . . . . 436
26.5 Finding more at RailsPlugin.org . . . . . . . . . . . . . . . . 439

27 Where to Go From Here 442

A Bibliography 444

Index 445

Report erratum
Prepared exclusively for Anton Fonarev this copy is (B10.0 printing, October 28, 2010)
Changes in the Beta Releases
Beta 10—October 28
This beta introduces a chapter on plugins and completes the first draft. Plug-
ins are not merely an afterthought or an advanced feature of Rails, with Rails
3.0 it is a fully architected way to augment or even replace base Rails func-
tionality.

This also completes the first draft. If you spot something missing, now would
be an excellent time to report it via the forums or via an errata. After a few
weeks of addressing comments it will be onto production where formatting
and typographical and indexing glitches will be resolved.

This draft has also been tested against the Rails 3.0.1 release. No changes
were needed to make the code in this book work against that release.

Beta 9—October 6
With this beta comes a new chapter on Rails’ dependencies. Understanding
these dependencies are as important as understanding Rails itself. Introducing
this chapter has produced a minor shifting of content: some text that originally
was present in the rather large chapter on Action View has moved into this one.
Additional shifts are expected in the next beta: all such will be noted here.

While running with edge rails directly from git is not recommended at this
time, those that do run such may spot that csrf_meta_tag has been renamed to
csrf_meta_tags in that release. This does not affect any scenario in the book.

As always, thanks for all of the wonderful feedback via the errata, forums, and
other venues. At this time I would like to specifically thank Leonel S, Martin
Zoller, and Jim Puls.

Beta 8—September 9
Rails 3.0 final has shipped! Even better news: no API changes that affect the
book were introduced in the process. In one case, namely in the use of an
Action View helper from a standalone library, you will want to be using the

Prepared exclusively for Anton Fonarev


B ETA 7—A UGUST 25 11

final release instead of any previous beta or release candidate, so please do


upgrade now if you haven’t already.

New with this beta are three new chapters completing the coverage of the
externals of Rails. Caching covers how to effectively optimize your applica-
tion by eliminating the overhead of re-computing results that rarely change.
Migrations covers how to maintain your schemas. And finally, Non-Browser
Applications shows you how to access some or all of Rails functions either
locally or remotely.

As we enter into the home stretch, your feedback becomes all the more impor-
tant. There is an Report Erratum link at the bottom right of every page. Use it
when you spot something, even if you aren’t sure! If you would like to start a
discussion, the forum is a better place for that.

Beta 7—August 25
We have a new release candidate of Rails, as well as an official release of Ruby
1.9.2. I’m pleased to report that once again, no changes were made to any Rails
API that affect the book. Furthermore, the regression that in the first release
candidate which broke the ability to build the guides has been addressed.

New with this beta is a chapter on Action View, which covers templates, helpers,
layouts, and partials. At this point, all three parts of the Model/View/Controller
architecture are covered. Next up will be a chapter on accessing Rails applica-
tions from outside of a web server, either directly via APIs or as a web service.

As always, thanks for all of the wonderful feedback via the errata, forums, and
other venues. At this time I would like to specifically thank Kim Shrier, Don
Smith, mltsy, and Jason Catena.

Beta 6—July 27
The big news is that the release candidate for Rails has officially shipped. The
better news is that no API changes were made to Rails that affect the book.
Hopefully at this point releases of Rails will be made more quickly, and the API
will remain stable.

New with this beta is a chapter on Action Dispatch and Action Controller,
which covers both dispatching of requests to controllers, as well as controllers
themselves. At this point, two of the three parts on the Model/View/Controller
architecture are complete. Next up will be a chapter on Views.

Once again, thanks for all of the wonderful feedback via the errata, forums,
and other venues – keep it coming!

Report erratum
Prepared exclusively for Anton Fonarev this copy is (B10.0 printing, October 28, 2010)
B ETA 5—J UNE 28 12

Beta 5—June 28
As I write this, the release candidate which was originally due on June 8th has
still not shipped, and we have decided to release a beta anyway. At the current
time, the contents of the book work with beta 4 and with the latest version of
Rails from github, but things could change between now and when the release
candidate ships.

The changes to Rails that affected this book in beta 4 were the requirement
to specify the keyword ’new’ when creating a new application with the ’rails’
command, and the fact that Rails 3.0 no longer works on Ruby 1.9.1. Ruby
1.9.2 preview 3, however, has come out and Rails 3.0 works just fine on it.
This beta has been updated to reflect these changes.

This beta also adds a chapter dedicated to Active Record, a topic which covered
three chapters in edition 3. The content has been updated to reflect Rails 3
APIs, and in particular ARel functionality. The content has been streamlined
to focus only on APIs that everybody needs to know, as well as content that
was adequately covered in Part II. It also reads less like a reference manual,
and more like a guide. Feedback welcome. In particular, please let me know if
something you feel is essential was not covered.

Again, thanks for all of the excellent errata. At this point, we are up to over
300 errata comments from over 80 individuals. I’d like to specifically thank
Seth Arnold, David Hadley, Will Bowlin, Victor Marius Costan, Kristian Riiber
Mandrup, Joe Straitiff, and Andy Brice.

Beta 4—May 26
This beta adds two chapters. The first recaps what was learned in part 2:
model, view, controller, configuration, testing, and deployment. It then contin-
ues with an explanation on how to generate documentation for your applica-
tion.

Chapter 18 is also new with this beta: it goes directory by directory through
your Rails application, describing what goes into each. You will see how to
generate documentation for Rails itself, how to build a Rake task, more infor-
mation on configuration options and naming conventions. This all sets the
stage for the chapters that follow.

The Rails team is in the process of deprecating config.log_path, but at the


present time has not settled on its replacement. Furthermore this property
is broken in Rails 3 beta 3. What you see in Section 16.3, Dealing with Log
Files, on page 253 reflects what currently works, which may not necessarily
be what will be supported in the final release.

Report erratum
Prepared exclusively for Anton Fonarev this copy is (B10.0 printing, October 28, 2010)
B ETA 3—M AY 11 13

Beta 3—May 11
This beta adds a deployment chapter which takes you through the installation,
configuration, and usage of a number of tools: Apache, Capistrano, MySQL,
and Passenger; as well as (mildly) deeper usage of Git and Bundler.

There’s not been another beta of Rails yet, so this is just a FYI at this point,
but usage of {{name}} syntax in i18n strings will be deprecated; the preferred
syntax is now %{name}.

As always thanks for all of the wonderful feedback via the errata, forums, and
other venues – keep it coming!

Beta 2—May 3
Thanks for all of the excellent feedback. To date we’ve gotten over 100 com-
ments from over 30 individuals. Special thanks go out to Trung LE, David
Hadley, Manuel E Vidaurre Arenas, Wayne Conrad, and Steve Nicholson. A lot
of the changes you’ll see in this second beta are the result of this input. Please
keep it up, as every comment helps us make this book better!

This new release adds coverage of sending mail and integration testing in the
new chapter “Task H: Sending Mail.” You’ll learn how to send mail, how to
function test mail, and how to integration test an end-to-end scenario span-
ning adding a product to a cart to the sending of a confirmation email.

Only one change to Rails affects the book this go around: Rails will be changing
the way that I18N and HTML safe strings interact. The text in the book has
been partially updated to reflect the new direction, but will continue to work
with Beta 3.

Report erratum
Prepared exclusively for Anton Fonarev this copy is (B10.0 printing, October 28, 2010)
Preface to the Fourth Edition
When Dave asked me to join as a coauthor of the third edition of this book,
I was thrilled. After all, it was from the first printing of the first edition of
this book that I had learned Rails. Dave and I also have much in common.
Although he prefers Emacs and Mac OS X and my preferences tend toward Vim
and Ubuntu, we both share a love for the command line and getting our fin-
gers dirty with code—starting with tangible examples before diving into heavy
theory.

Since the time the third edition was published (and, in fact, since the first, sec-
ond and third editions), much has changed. Rails is in the process of being sig-
nificantly refactored, mostly internally. A number of features that were used in
previous examples have been initially deprecated and subsequently removed.
New features have been added, and much experience has been obtained as to
what the best practices are for using Rails. Rails now also works on Ruby 1.9,
and each of the examples have been tested with Ruby 1.8.7 and Ruby 1.9.2.

Additionally, Rails has exploded from being a popular framework to an active


and vibrant ecosystem, complete with many popular plugins and deep inte-
gration into third party tools. In the process, Rails has become mainstream,
attracting a more diverse set of developers to the framework.

This has led to a reorganization of the book. Many newcomers to Rails have
not had the pleasure of being introduced to Ruby, so this section has been
promoted from an appendix to a chapter in the first section. We follow this
section with a step-by-step walk through of building a real application, which
has been updated and streamlined to focus on current best practices. But the
biggest change is in the final section: as it is no longer practical to cover the
entire ecosystem of Rails given both its breadth and rate of change, what this
section is now focused on is to provide an overall perspective of the landscape,
enabling you, the reader, to know what to look for and where to find plug-
ins and related tools to address common needs that go far beyond what the
framework itself contains.

Prepared exclusively for Anton Fonarev


P REFACE TO THE F OUR TH E DITION 15

In short, this book needed to adapt. Once again.

Sam Ruby
April 2010

Report erratum
Prepared exclusively for Anton Fonarev this copy is (B10.0 printing, October 28, 2010)
Acknowledgements
You’d think that producing a new edition of a book would be easy. After all,
you already have all the text. It’s just a tweak to some code here and a minor
wording change there, and you’re done. You’d think....

It’s difficult to tell exactly, but our impression is that creating each edition
of Agile Web Development with Rails took about as much effort as the first
edition. Rails is constantly evolving and, as it does, so has this book. Parts
of the Depot application were rewritten several times, and all of the narrative
was updated. The emphasis on REST and the avoidance of features as they
become deprecated have 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 help from the
Ruby and Rails communities. Each edition of this book has been released as
a beta book: early versions were posted as PDFs, and people made comments
online. And comment they did: more than 1,200 suggestions and bug reports
were posted. The vast majority ended up being incorporated, making this book
immeasurably more useful than it would have been. Thank you all, both for
supporting the beta book program and for contributing so much valuable
feedback.

The Rails core team has been incredibly helpful, answering questions, check-
ing out code fragments, and fixing bugs. A big thank you to the following:

Scott Barron (htonl), Jamis Buck (minam), Thomas Fuchs (madrobby),


Jeremy Kemper (bitsweat), Yehuda Katz (wycats),
Michael Koziarski (nzkoz), Marcel Molina Jr, (noradio),
Rick Olson (technoweenie), Nicholas Seckar (Ulysses),
Sam Stephenson (sam), Tobias Lütke (xal), José Valim (josevalim), and
Florian Weber (csshsh)

We’d like to thank the folks who contributed the specialized chapters to the
book: Leon Breedt, Mike Clark, James Duncan Davidson, Justin Gehtland,
and Andreas Schwarz.

Prepared exclusively for Anton Fonarev


A CKNOWLEDGEMENTS 17

From Sam Ruby


This effort has turned out to be both harder and more rewarding than I would
have ever anticipated. It’s been harder in that Rails has changed so much and
there has been so much to learn (in terms of Rails 2.0, in terms of SQLite 3,
and also in terms of working with a different publisher, operating system, and
toolset). But I can’t begin to express how much I like the beta book program—
the readers who this book has attracted so far have been great, and their
comments, questions, and feedback have been most appreciated.

Sam Ruby
April 2010
rubys@intertwingly.net

From Dave Thomas


I keep promising myself that each book will be the last, if for no other reason
than each takes me away from my family for months at a time. Once again:
Juliet, Zachary, and Henry—thank you for everything.

Dave Thomas
November 2006
dave@pragprog.com

Report erratum
Prepared exclusively for Anton Fonarev this copy is (B10.0 printing, October 28, 2010)
In this chapter, we’ll see
• What rails is,
• agile practices,
• who the book is for, and
• how to read the book.

Introduction
Ruby on Rails is a framework that makes it easier to develop, deploy, and
maintain web applications. During the months that followed its initial release,
Rails went from being an unknown toy to being a worldwide phenomenon and,
more important, it has become the framework of choice for the implementation
of a wide range of so-called Web 2.0 applications.

Why is that?

Rails Simply Feels Right


First, 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
were using Java, PHP, or .NET—there was a growing sense that their job was
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. Java developers are used to frameworks such
as Tapestry and Struts, which are based on MVC. But Rails takes MVC further:
when you develop in Rails, you start with a working application, there’s a
place for each piece of code, and all the pieces of your application interact in a
standard way.

Professional programmers write tests. And again, Rails delivers. All Rails appli-
cations have testing support baked right in. As you add functionality to the
code, Rails automatically creates test stubs for that functionality. The frame-
work makes it easy to test applications, and as a result, Rails applications
tend to get tested.

Prepared exclusively for Anton Fonarev


R AILS S IMPLY F EELS R IGHT 19

Rails applications are written in Ruby, a modern, object-oriented scripting


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) are easy to read months later.

Rails takes Ruby to the limit, extending it in novel ways that make a pro-
grammer’s life easier. This 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, just think about how much
information is being expressed in a few lines of code.
class Project < ActiveRecord::Base
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

Two other philosophical underpinnings keep Rails code short and readable:
DRY and convention over configuration. DRY stands for don’t repeat yourself :
every piece of knowledge in a system should be expressed in just one place.
Rails uses the power of Ruby to bring that to life. You’ll find very little duplica-
tion 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 schema could involve them in half a dozen or more code changes, this
was a revelation.

Convention over configuration is crucial, too. It means that Rails has sensi-
ble 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 Java web application uses in XML configuration. If you need to
override the conventions, Rails makes that easy, too.

Developers coming to Rails found something else, too. Rails isn’t playing catch-
up with the new de facto web standards; it’s helping define them. And Rails
makes it easy for developers to integrate features such as Ajax and RESTful
interfaces into their code, because support is built in. (And if you’re not famil-
iar with Ajax and REST interfaces, never fear—we’ll explain them later in the
book.)

Report erratum
Prepared exclusively for Anton Fonarev this copy is (B10.0 printing, October 28, 2010)
R AILS I S A GILE 20

Developers are worried about deployment, too. They found that with Rails you
can deploy successive releases of your application to any number of servers
with a single command (and roll them back equally easily should the release
prove to be somewhat less than perfect).

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 bottle them up 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. Some-


how, it just 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. You may be sur-
prised to discover that we don’t have explicit sections on applying agile prac-
tices X, Y, and Z to Rails coding.

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 as a set of four pref-
erences:1

• 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. There are no heavy toolsets,
no complex configurations, and no elaborate processes. There are 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.

Rails doesn’t denounce documentation. Rails makes it trivially easy to cre-


ate HTML documentation for your entire codebase. But 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 devel-
opers 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
1. http://agilemanifesto.org/. Dave Thomas was one of the seventeen authors of this document.

Report erratum
Prepared exclusively for Anton Fonarev this copy is (B10.0 printing, October 28, 2010)
Other documents randomly have
different content
supremazia del potere sacerdotale sui pubblici studii. E per
mantenere una continua ingerenza sulle scuole, concesse larghi
poteri all'arcidiacono. Il quale soleva essere un prelato, scelto dal
papa come suo rappresentante nella città di Bologna e chiamato
Cancellier Maggiore dello Studio, investito della facoltà di laureare in
tutte le scienze; di assolvere dottori e scolari incorsi nella scomunica
per aver percosso i chierici; di nominare in sua assenza un vicario, e
di partecipare ad un emolumento sulle promozioni.
L'arcidiacono in Bologna, e il vescovo nelle altre università,
partecipavano insieme al Rettore e ai dottori alla giurisdizione civile e
criminale, ed era lasciata libertà alla parte di scegliere fra questi tre
poteri, il proprio giudice.
L'autorità dell'arcidiacono in Bologna fu accresciuta dai papi che
succedettero ad Onorio III, i quali liberarono tal dignitario dai vincoli
delle leggi canoniche e in parte dagli oneri della gerarchia
ecclesiastica [166]. Celestino V concesse all'arcidiacono, perchè la sua
presenza fosse utile all'università, di riscuotere tutti i frutti delle
parrocchie a lui sottoposte senza obbligo di residenza. Lo stesso
privilegio venne dipoi conferito anche da Bonifazio VIII nel 1294 e da
papa Benedetto nel 1341 [167].
Un'autorità così estesa come quella dell'arcidiacono era mal
conciliabile colla indipendenza di cui godeva l'università, e perciò
frequenti discordie avvenivano fra il potere ecclesiastico che, in onta
agli statuti e alle consuetudini, vantava diritti di precedenza, ed i
Rettori che rappresentavano legalmente il supremo potere
scolastico [168].
Nell'università di Padova il potere ecclesiastico esercitò la sua
influenza in limiti assai più ristretti, perchè la repubblica di Venezia,
dalla quale dipendeva, non soffriva che altre autorità s'ingerissero
della vigilanza di quello Studio. Sebbene qualche volta si trovi
ricordato fin al secolo XV il vescovo in luogo del Rettore e incaricato
di sostituirlo nel grado scolastico; nel 1426 con lettere ducali fu tolto
questo abuso.
Nel 1437 il Senato decretò ancora che le controversie che nascevano
tra i collegi e che solevansi sottoporre alla decisione del vescovo,
fossero in avvenire portate dinanzi al pretore della città eccetto
quelle relative al collegio dei teologi [169].
Nel secolo successivo la storia di quell'università ci offre esempi assai
più rilevanti di emancipazione dall'autorità ecclesiastica. Nel 1564 il
Rettore dei giuristi a nome dei cisalpini scrisse all'imperatore
Massimiliano perchè inducesse il Senato di Venezia di mandare agli
scolari cisalpini che volevano prendere i gradi scolastici e la laurea, di
non fare professione di fede cattolica come aveva prescritto il
pontefice Pio IV. Di più per favorire gli stranieri non cattolici, si
fondarono nuovi collegi universitarii, che per contrapporli a quelli già
esistenti nei quali aveva influenza il potere ecclesiastico, furono detti
veneti (Collegia Veneta).
Da questi esempi e da molti altri che si potrebbero riferire,
desumiamo che l'ingerenza della Chiesa nelle università non era mai
uniforme, ma variava da una città ad un'altra secondo le diverse
costituzioni politiche. Quando lo Stato cominciò a prender parte
diretta all'ordinamento degli studii e a regolarne l'esercizio con leggi
speciali, l'autorità ecclesiastica nelle scuole andò sempre scemando,
finchè non rimase al clero che una parziale e limitata ingerenza negli
studii di teologia e di diritto canonico.
CAPITOLO SECONDO

Persone che formavano l'università — Il Rettore — Origine di


questo ufficio e sua importanza — Elezione del Rettore —
Il Sindaco — Natura di questo ufficio e privilegi che vi
erano annessi — I Consiglieri rappresentanti delle nazioni
degli scolari — Il Notaro — Gli Attuari o Archivisti — Il
Massaro o tesoriere — I Peziarii — Gli Stazionari — I
Bidelli — I copisti e miniatori di libri.

Dopo aver parlato dell'origine e della costituzione delle università


italiane del medio evo, è utile studiare quale fosse il numero e il
grado delle persone di cui esse erano composte.
L'università poteva esser considerata sotto due aspetti: o come
aggregato di individui che componevano la corporazione, o come
istituto di pubblico insegnamento e centro di attività scientifica. Sotto
il primo aspetto le università antiche rivestite di riconoscimento
legale, godevano di piena ed assoluta indipendenza e di personalità
giuridica. Il carattere della corporazione (universitas) predomina nel
medio evo ed è la forma peculiare che assunsero questi grandi corpi
scolastici nel loro nascere.
Considerate come istituti di scienza, le università del medio evo
erano le sedi esclusive del sapere e dell'operosità intellettuale di quel
tempo. Bisogna distinguere adunque due classi di persone: quelle
destinate a sorvegliare e dirigere gli interessi del corpo accademico,
ad esercitare la giurisdizione scolastica e ad attendere al pubblico
servizio; e quelle cui era affidato l'insegnamento e il progresso
scientifico.
Considerati rapporto al loro grado e alla varietà delle loro funzioni, i
membri delle università antiche possono distinguersi così:

1º Il Rettore;
2º Il Sindaco;
3º I Consiglieri;
4º Il Notaro;
5º Gli Attuari o Archivisti;
6º Il Massaro o Tesoriere;
7º I Peziarii;
8º Gli Stazionari;
9º I Bidelli;
10º I copisti, i miniatori, i rilegatori di libri, ecc.

L'istituto scientifico era composto dei professori (doctores legentes) e


degli scolari: ai quali si univano anche gli scolari insegnanti, i
baccellieri, i licenziati, i ripetitori come vedremo a suo luogo.
Ora intanto comincieremo a parlare delle persone che formavano il
corpo scolastico, e prima delle altre, del Rettore che era il supremo
grado dell'università. L'origine dei Rettori può dirsi contemporanea a
quella della università. A questo primo grado accademico fu data
sempre grande importanza e si curò in ogni tempo di conservarne il
prestigio perchè in esso si concentrava la potenza e il decoro di tutte
l'università.
I Rettori, benchè trovassero nemici che tentarono talvolta di abolirne
l'ufficio o menomarne la dignità, furono sempre conservati e restituiti
nel loro grado.
La necessità del Rettore fu sempre riconosciuta. Richiesti i dottori,
dice il Middendorpio [170], se possa esservi università senza Rettori,
risposero che no, perchè il Rettore è capo dell'università, e se vien
tolto, essa diviene acefala e deforme. E infatti tanta era la necessità
di quello ufficio, che anche quando mancava il Rettore in una
università erano chiamati a farne le veci o il sindaco o taluno dei
consiglieri, o il preside dei collegi e talvolta anche il vescovo [171].
I dottori generalmente favorirono tale istituzione sebbene alcuni di
loro, tra i quali Azone e Accursio, negassero agli scolari il diritto di
eleggere a questa carica. Odofredo invece, e con lui molti altri,
riconoscono legittima l'elezione dei Rettori fatta dagli scolari [172].
Il Rettore nel disimpegno delle sue funzioni, e quando era rivestito
delle insegne del suo grado, si stimava superiore a qualunque altra
dignità sia civile sia ecclesiastica; come pure agli scolari cardinali:
privilegio che gli fu concesso da una bolla papale [173].
In antico l'ufficio di Rettore sembra che fosse occupato da un
ecclesiastico. Il Savigny parlando dell'origine di questo grado,
esclude affatto che per gli statuti bolognesi e di altre università
ancora, fosse ritenuta necessaria la qualità di chierico (clericus) nel
Rettore, e vuol dimostrare che tal voce avea in quel tempo e nel
linguaggio scolastico, un significato uguale a quello di scolare. Ma
non si può, a parer mio, conciliare questa versione in modo alcuno
colle stesse parole degli statuti che adoperano sempre il nome di
scolare (scholaris) nel suo vero e genuino significato. Esaminando
poi il disposto di certi statuti oltre quello di Bologna, si rileva con
tutta evidenza che nelle consuetudini accademiche era ritenuta
necessaria la qualità di ecclesiastico secolare nella persona che
doveva essere eletta al grado di Rettore in una università [174].
Una differenza sostanziale, relativamente all'ufficio e al modo
d'elezione dei Rettori, si manifesta tra le antiche università italiane e
le francesi. In Francia il Rettore era eletto dai dottori i quali gli
conferivano la giurisdizione civile e penale da esercitarsi sugli scolari
e le altre persone che facevano parte della corporazione.
In Italia invece il Rettore veniva nominato col libero suffragio dei soli
scolari, nei quali risiedeva la facoltà d'investirlo del suo grado e di
conferirgli l'esercizio dei supremi poteri.
Nella formazione delle prime università pare indubitato che si
eleggessero più Rettori divisi per nazioni. In Bologna, Padova,
Vercelli si trovano ricordati quattro diversi Rettori; uno per i
citramontani e gli altri tre per gli oltramontani. Verso la metà del
secolo XII il numero dei Rettori venne limitato: e ne fu eletto uno
per ciascuna delle due università.
Sembra che la prima fra le nostre università che ebbe quattro Rettori
fosse Bologna come la più antica e frequentata. Dietro il suo
esempio si ordinarono ancho le altre. Nell'università di Vicenza i
quattro Rettori nel secolo decimoterzo erano: un inglese, un
provenzale, un tedesco, e un cremonese.
In Vercelli ne troviamo uno per i francesi, uno per gli italiani, uno per
i tedeschi, e un altro per i provenzali [175].
Nell'elezione del Rettore, come in qualunque altro atto dell'interna
amministrazione delle antiche università, erano esclusi i cittadini; sia
perchè ogni estranea ingerenza era contraria all'indole della primitiva
loro costituzione; sia perchè ammettendo anche i cittadini a
partecipare a queste elezioni, essi avrebbero potuto influire col
numero sull'esito della nomina, e dar cagione a discordie e
turbolenze [176].
In qualche università l'elezione del Rettore era divisa fra i professori
e gli scolari come in quella di Roma. In Napoli fino al 1610, in cui
furono promulgati nuovi statuti, il Rettore veniva scelto dal sovrano e
dipendeva dal primo Cappellano del re che era incaricato di
esercitare in suo nome l'alta sorveglianza sopra lo Studio. In seguito
anche l'università di Napoli si uniformò alle altre, lasciando l'elezione
del Rettore agli scolari.
Per procedere alla nomina del Rettore si teneva conto dell'età, del
grado di nobiltà e della fama della persona sulla quale doveva cadere
la scelta. Gli statuti e le consuetudini scolastiche imponevano ancora
di osservare che il Rettore fosse ben provveduto di patrimonio,
perchè non avvenisse che esercitando il suo magistero dovesse
cercarvi, anzichè una cagione di gloria, un lucro indecoroso.
Quando fu divisa l'università dei giuristi da quella delle arti, ognuna
di esse ebbe il suo Rettore che prendeva nome da quella cui
apparteneva. Per molto tempo però il Rettore delle arti fu
considerato molto inferiore all'altro dei legisti, e da questo doveva
essere sanzionata la sua elezione.
Ai Rettori come privilegio era concessa la facoltà d'insegnare, e in
molte università si destinava loro una cattedra nominale, alla quale
era assegnato anche un certo stipendio che serviva a compensare in
parte le spese che occorrevano per mantenere il decoro del grado.
A Padova lo stipendio del Rettore era di 50 ducati e poi fu esteso a
100. Nell'università di Pisa fu pure assegnato nel 1473 uno stipendio
di 40 fiorini che poi fu portato a 60 e in ultimo a 100 [177]. Il nome
del Rettore che godeva di questo privilegio, era iscritto in segno di
onore nel Ruolo dei professori, e in primo luogo.
La funzione colla quale si eleggeva il Rettore era una delle più grandi
ed imponenti solennità scolastiche del medio evo. Alcuni giorni
innanzi la cerimonia, venivano invitati con gran pompa tutti i
professori, il vescovo, il preside e tutti gli altri magistrati c dignitari
della città. Il luogo destinato alla funzione era ordinariamente la
cattedrale. All'ora fissata si muoveva il corteggio. Precedevano
quattro trombettieri e altrettanti tamburi: poi venivano i donzelli e
dodici scolari che portavano i fasci dorati che erano un segno di
dignità che ricordava i fasci di verghe dei magistrati romani.
Venivano poi quelli che custodivano il sigillo e gli statuti
dell'università portando il cappuccio del Rettore, e dietro un bidello
collo scettro d'argento.
In mezzo al corteggio procedeva il nuovo Rettore vestito di una toga
rossa con ornamenti d'oro e in sua compagnia stavano il sindaco, i
consiglieri e gli altri ufficiali addetti all'università, vestiti essi pure
colla toga e con tutti i distintivi del loro grado. In ultimo tutti gli
scolari chiudevano il corteggio.
In chiesa si trovava il vescovo con tutti i magistrati municipali.
Scambiatisi i saluti d'uso, ognuno si poneva al luogo che gli era stato
destinato. Veniva allora letta da uno dei dottori una orazione in lode
dell'università, dei magistrati e del nuovo Rettore. Finita l'orazione,
un professore a ciò eletto, poneva il cappuccio al Rettore e gli
consegnava il sigillo e gli statuti dell'università. Allora il Rettore
rispondeva acconcie parole ringraziando dell'onore statogli conferito
e promettendo di esercitare il suo magistero con prudenza e
giustizia. Così aveva termine la cerimonia nella cattedrale.
Uscito il corteggio dalla chiesa, si dirigeva collo stesso ordine alla
casa del Rettore passando per le vie principali della città tutte
addobbate ed ornate in segno di festa. Poi si imbandivano le mense
alle quali venivano invitati i primi dignitari così dell'ordine scolastico
come del municipale [178].
Il rimanente del giorno era impiegato in giuochi e sollazzi pubblici
con giostre, corse, tornei, ai quali prendeva parte l'intera città, e ai
vincitori venivano distribuiti i premii dalle mani del Rettore.
Tanto le spese dei banchetti quanto quelle delle pubbliche feste
erano tutte a carico del nuovo eletto.
Le onoranze fatte al Rettore non si limitavano soltanto all'occasione
di questa solennità della sua nomina ed investitura. Anche durante
l'esercizio del suo magistero, godeva di grandi privilegi come
supremo rappresentante e capo dell'università.
In pubblico andava sempre accompagnato, e nelle solennità
occupava il primo luogo fra tutte le altre autorità sì civili come
ecclesiastiche. Quando dovea uscire poi dalla città per rappresentare
lo Studio in qualche fausta occasione, andava vestito di tutte le
insegne del grado e accompagnato dai dottori, dagli scolari e
preceduto dai bidelli o nuncii con ricchi abiti.
Nell'università il potere del Rettore corrispondeva all'altezza del
grado e alla nobiltà del suo ufficio. Egli era arbitro supremo in tutte
le cause, avea piena e libera giurisdizione tanto civile quanto
criminale sopra tutti i membri del corpo scolastico e presiedeva i
pubblici esperimenti e le prove solenni nelle quali si conferivano i
gradi e le promozioni accademiche. Inoltre aveva diritto di essere il
primo a rivolgere le domande e formulare i quesiti nelle pubbliche
dispute non solo agli scolari, ma anco ai professori. Esaminati i meriti
degli insegnanti, spettava al Rettore di formare annualmente il ruolo
o Rotolo. E questo potere era così illimitato, che anche quando lo
Stato avocò a sè il diritto di nominare i professori, i Rettori tentarono
di escludere le persone proposte per surrogarvene altre di loro
scelta.
Avendo il Rettore la giurisdizione disciplinare sopra tutte le persone
che facevan parte dell'università, poteva ammonire, imporre multe
ed anche espellere dai collegi e dalle scuole; come vedremo
parlando dei privilegi.
Il Rettore godeva anche di molti vantaggi pecuniarii sugli
emolumenti dei collegi, e per l'assistenza alla promozione aveva
diritto ad una doppia parte di ciò che percepivano i dottori.
Sebbene circondato di tanti onori e rivestito di grande autorità,
l'ufficio di Rettore veniva spesse volte fuggito, non trovandosi
persone sempre disposte ad accettarne gli obblighi e la grave
responsabilità. Fu d'uopo quindi alle università aumentarne i privilegi
e le concessioni oltre a quelle di cui abbiamo già fatto parola.
Verso la fine del secolo XV cominciò il Rettore a prendere il titolo di
Magnifico (Rector Magnificus).
Molte università concessero ai loro Rettori di prendere la laurea
senza spesa; privilegio che si estendeva anche ai loro successori. In
Padova nel 1544, insieme alla laurea il Rettore veniva insignito del
titolo di cavaliere, e l'università provvedeva del proprio a tutte le
spese dell'investitura. Fu accordato anche a qualche Rettore dei più
benemeriti di poter proporre una persona di sua scelta (socium) per
ottenere la laurea senza spesa. Questo privilegio che aveva il suo
fondamento sopra antiche concessioni, fu ristabilito nell'università di
Padova con un decreto del Senato veneziano del 1568.
La morte del Rettore era cagione di pubblico lutto, e prendevano
parte ai funerali tutti i magistrati della città, la curia, i collegi, gli
ufficiali dell'università e gli scolari vestiti di nero.
Dopo il Rettore veniva per ordine di grado il Sindaco (Syndacus) che
era incaricato di rappresentare in giudizio l'università e far le veci del
Rettore vacante. Perciò era chiamato anche Prorector o Vicerector e
se ne trovano frequenti esempi nell'università di Padova e di Pisa.
Il Sindaco era eletto ogni anno dagli scolari ed era sottoposto alla
giurisdizione comune. Questo grado è assai antico d'origine. In
Bologna se ne trova fatta menzione fino dall'anno 1295 [179].
Il Sindaco godeva di alcuni privilegi inerenti al suo ufficio.
Aveva in certe università il doppio voto nelle assemblee; e
presiedeva nelle funzioni pubbliche i Decurioni della città [180].
In Padova gli fu concesso, oltre questi privilegi, quello di prendere la
laurea «more nobilium» cioè senza esame nè spese [181]. Sino a
tempi assai recenti il Sindaco di quell'università godeva di molti
beneficii. Nel 1723 gli fu accordata facoltà di scegliere uno scolare
(socium) da laurearsi senza indugio, e gratuitamente. Il Sindaco che
prendeva la laurea, godeva una preferenza sugli altri promossi a
questo grado, cioè di essere ammesso a pieni voti (ut nemine
dissentiente) anche se avesse meritato di essere approvato soltanto
a pluralità (pro majori parte) [182].
Mancando il Sindaco, erano eletti fra i membri dell'università, alcuni
sostituti incaricati di rappresentarlo detti «Prosyndici,» ai quali pure,
mentre occupavano questo grado, si concedevano diversi
privilegi [183].
Ciascuna nazione che faceva parte dell'università, veniva
rappresentata dai suoi consiglieri, i quali formavano insieme al
Rettore il consiglio accademico. I consiglieri (Consiliarii) prendevano
parte al governo dell'università tutelando il decoro e gli interessi
della nazione che li aveva eletti.
I consiglieri dei tedeschi godevano di qualche maggiore privilegio
sugli altri. La nazione tedesca in Padova era la più favorita, e quei
che vi appartenevano erano ammessi a prendere l'iscrizione come
scolari presso i loro consiglieri [184]. Non è certo se nelle altre
università godessero di ugual preferenza.
In mancanza del Sindaco era chiamato a surrogarlo un Consigliere
tedesco.
Generalmente i Consiglieri della nazione tedesca erano rivestiti di
una speciale giurisdizione sui loro connazionali, la quale escludeva
anche quella del Rettore e dei magistrati ordinarii.
Quando il Consigliere dei tedeschi faceva le veci del Sindaco
nell'università, godeva il privilegio di ottenere la laurea senza esame
e senza spese cioè «more nobilium [185].» Oltre a questo gli fu
concesso ancora di percepire durante l'assenza del Sindaco tutti gli
emolumenti e diritti inerenti a quel grado [186].
I Consiglieri erano eletti dagli scolari della propria nazione. In Ferrara
con un decreto del 1651 fu ordinato che per essere eletti a tale
ufficio i candidati dovessero mostrare le loro matricole, e gli attestati
di aver frequentato assiduamente le scuole [187].
Il Notaro era l'ufficiale rivestito di fede pubblica, incaricato di
redigere e compilare tutti gli atti relativi all'università e ai membri
che ne facevano parte.
V'era un solo Notaro, comune all'università dei giuristi e degli artisti.
Quest'ufficiale era retribuito per ogni atto che redigeva, e godeva di
più di un piccolo emolumento annuo.
In certe università gli erano affidate anche altre speciali attribuzioni.
Così in Bologna era incaricato di tenere un registro di tutte le case
da affittare nella città per comodo degli scolari [188]. Vi erano inoltre
alcuni ufficiali incaricati di conservare tutti gli atti concernenti
l'università e che potevano avere interesse per la sua storia. Questi
Attuarii, o, come oggi direbbesi, Archivisti, conservavano nel
tabulario (tabularium) i documenti universitarii per ordine di tempo e
d'importanza. Ciascuna delle due università aveva il suo Attuario.
A questi ufficiali era affidato anche il sigillo dello Studio.
La nomina ad un tal grado era personale. Si trova soltanto un
esempio in Padova di Attuario che prese per aiuto un suo nipote a
patto che mentre viveva gli dovesse prestare l'opera gratuita; e dopo
la sua morte avesse diritto di succedergli [189].
Gli Attuarii erano stipendiati dall'università alla quale prestavano il
loro ufficio.
Il Massarius o tesoriere era un altro grado onorifico concesso in
alcune università agli scolari, in altre ai dottori. Così per gli statuti del
collegio di medicina dell'università di Torino, questo ufficiale doveva
essere scelto fra i dottori più giovani del collegio [190].
In Ferrara, invece, tal grado era riserbato a quelli scolari che
avessero dato prove di maggiore assiduità e diligenza nello
studio [191].
In Bologna il Massarius era scelto ogni anno dai negozianti della
città [192].
Gli statuti dell'università di Bologna fanno parola di certi ufficiali detti
Peziarii dalla voce Petia che significava una forma comune dei
manoscritti adoprati nelle scuole.
I Peziarii erano incaricati di esercitare una rigorosa sorveglianza sul
commercio librario di quel tempo. Erano eletti ogni anno insieme ai
Sindaci dai Rettori e Consiglieri dello Studio. I Peziarii debbono
essere, dice lo statuto bolognese, «sex boni viri de gremio nostrae
universitatis providi et discreti qui sint clericali ordine insigniti [193].»
Avanti di entrare in ufficio erano sottoposti al giuramento e distribuiti
in parti uguali fra gli oltramontani e i citramontani.
Le condizioni per essere investiti di questo grado, erano le seguenti:
a) Appartenere all'università;
b) Essere insigniti d'ordine ecclesiastico;
c) Giurare di prestare fedelmente i proprii servigi all'università.
I Peziarii aveano l'obbligo di provvedere ai manoscritti errati; di
sottoporre i copisti e gli Stazionari al giuramento; di denunziare al
Rettore tutti i manoscritti scorretti.
Dovevano inoltre registrare in un pubblico catalogo le opere che
credevano più utili ad essere studiate, e le meglio corrette.
Tutte le altre non comprese in questa nota, non potevano servire di
testo per l'insegnamento pubblico.
Nei tempi di vacanza erano incaricati di esaminare minutamente tutti
i manoscritti posseduti dagli Stazionari e riferirne al Rettore, che una
volta al mese doveva sorvegliare la loro condotta.
Nelle altre università non si trovano ricordati i Peziarii, nè risulta
chiaramente dagli statuti nè dalle memorie che ci rimangono, se vi
fossero nemmeno altri ufficiali di diverso nome incaricati di esercitare
analoghe attribuzioni. Forse in Bologna, dove gli scolari erano in
maggior numero, fu necessario creare un tale ufficio di speciale
sorveglianza sugli Stazionari e copisti, perchè i manoscritti che
circolavano fra gli studiosi fossero ben corretti e non servissero a
propagare errori nelle scuole.
Nelle università meno frequentate invece, essendo assai più limitato
il numero dei manoscritti, e quindi più facile al Rettore di esaminarli
senza l'aiuto di altre persone a ciò specialmente incaricate, l'ufficio
dei Peziarii si sarebbe reso inutile.
Abbiamo ricordati testè gli Stazionari, senza dichiarare qual fosse il
significato di un tal nome nel linguaggio delle antiche nostre
università. Vediamo brevemente l'indole di quest'ufficio che avanti
l'invenzione della stampa formava il centro di tutto il commercio
librario nelle scuole medioevali.
Gli Stazionari (Stationari) erano incaricati dagli statuti universitarii di
tenere presso di sè tutti i codici e i manoscritti che dovevano servire
di testo per l'insegnamento, e darli in prestito, con un correspettivo
fisso, ai dottori e agli scolari che ne facevano domanda [194].
Era imposto agli Stazionari di possedere manoscritti bene ordinati e
corretti; di non venderli a nessuna scuola straniera nè eccedere il
prezzo stabilito dagli statuti. Dovevano anche prestar giuramento, e
dare cauzione che garantisse l'università dell'esatta osservanza dei
doveri della loro professione. Gli statuti prescrivevano anche il
numero delle opere che doveano tenere presso di sè gli Stazionari. Il
catalogo che rimane ancora dell'università di Bologna, contiene
centodiciassette di queste opere, ad ognuna delle quali viene
assegnato un prezzo in proporzione della importanza e della
diffusione che avevano nelle scuole. In generale il prezzo ascendeva
a quattro denari per quaderno, o pecia [195].
Il privilegio di dare libri in prestito non era soltanto degli Stazionari.
Talvolta facevano loro concorrenza in questa industria anche i bidelli,
come pure i professori, sebbene più raramente [196].
Il commercio dei libri era ristretto fra i soli membri dell'università.
Nessuno poteva comprare libri fuorchè per uso proprio, o per dargli
in prestito.
Anche agli scolari era rigorosamente vietato di trasportare i
manoscritti fuori dell'università nella quale studiavano [197].
Gli statuti di Bologna vietavano agli Stazionari di domandare per i
manoscritti che imprestavano un prezzo maggiore di quello stabilito
nel catalogo, e di acquistare libri all'insaputa del proprietario [198].
Gli Stazionari godevano come tutti gli altri membri delle università i
privilegi scolastici, fra cui l'esenzione dal servizio militare, e in
qualche Studio anche di un piccolo assegno [199].
Le raccolte dei libri degli Stazionari erano riserbate al solo uso dei
dottori e degli scolari e non potevano avervi accesso libero altro che i
copisti incaricati di prendere gli esemplari. Lo statuto di Bologna dice
che a nessun privato debbano esser dati in prestito i manoscritti, nè
aiuto, nè consiglio o favore alcuno; nè possano i copisti o gli
Stazionari tener discorso di ciò sotto pena di essere espulsi
dall'università. Il ruolo degli espulsi era tenuto dal Notaro ed esposto
pubblicamente.
In Bologna gli Stazionari erano obbligati a dare cento lire di
cauzione.
Era loro imposto di tenere un registro esatto di tutti i pegni che
ricevevano per imprestito di libri. In caso che lo scolare, cui era stato
prestato il manoscritto, lo avesse perduto, dovea pagare dieci soldi
bolognesi. Se lo scolare però asseriva di averlo restituito, si dovea
stare al suo giuramento; se poi era stato consegnato ad altri, era
chiamato a provvedervi il Rettore. Quando il manoscritto smarrito di
cui lo scolare aveva pagato l'ammenda, fosse stato trovato, gli
doveva essere restituita la somma sborsata, detratto però quel tanto
che aveva speso del suo lo Stazionario per recuperarlo [200].
Tutti quelli che conservavano i manoscritti dei copisti o degli
Stazionari espulsi, erano sottoposti all'ammenda, ed in caso di
recidiva essi pure soggiacevano alla espulsione dall'università. Ogni
Stazionario doveva tenere perciò nella sua bottega un registro di
tutti i copisti, correttori e legatori di libri che erano incorsi in quella
pena [201].
Talvolta gli Stazionari prendevano un diverso nome. Così nella Carta
dello Studio di Vercelli del 1228 gli ufficiali incaricati di conservare gli
esemplari dei testi e di fornirgli ai copisti, sono chiamati (forse con
frase più propria), exemplatores [202].
Al servizio interno delle università erano addetti i bidelli (Bidelli) che
aveano l'incarico di assistere i professori durante le lezioni, e di
vigilare al buon ordine nelle scuole. I bidelli non aveano stipendio
fisso; ma erano mantenuti colle collette degli scolari. Ogni università
aveva un bidello generale (Bidellus generalis) che era superiore agli
altri e dirigeva il servizio.
L'uso introdotto di pagare i bidelli con volontarie oblazioni è spiegata
dal Facciolati in questa maniera. In antico i soli dottori ordinarii
erano remunerati con pubblico stipendio. Tutti gli altri venivano
pagati dagli scolari, e si erano assunti i bidelli l'incarico di riscuotere
le loro offerte. Quando in seguito anche i professori straordinari
furono ammessi alla partecipazione degli emolumenti concessi dal
pubblico erario, i bidelli conservarono l'antica consuetudine e
seguitarono a riscuotere per sè quel che prima andava a vantaggio
dei professori [203].
I bidelli solevano fare tre collette all'anno.
I loro guadagni erano in proporzione del numero degli scolari, e
anche di certe straordinarie attribuzioni che erano loro affidate.
Citeremo vari esempi. In Padova nell'anno 1575 fu permesso al
bidello, non ostante lo Statuto, di farsi rilegatore di libri (et hoc
stante ejus inopia et parvo numero Scholarium) [204].
Nel 1667 facendo spesso il Consigliere dei tedeschi le veci del
Sindaco nell'università, il bidello di quella nazione dovendo prestare
questo straordinario servigio fu ammesso a godere di una
retribuzione di tre lire venete per ogni laurea [205].
Nell'università di Bologna poi fuvvi un bidello di nome Gallopesso
Tarentino, il quale essendo di corpo deforme, ma piacevole per i suoi
motti e bizzarrie, seppe così astutamente conciliarsi la simpatia degli
scolari, che alla sua morte lasciò duemila lire bolognesi: somma
molto rilevante per quei tempi [206].
Generalmente i bidelli erano eletti dall'università; ma per eccezione
talvolta era permesso ai professori di nominarne uno di loro
fiducia [207].
I doveri inerenti a questo ufficio, erano i seguenti:
a) Assistenza ai professori durante le lezioni e le dispute, in ogni
tempo e in qualunque luogo;
b) Vigilanza pel buon ordine e la nettezza delle scuole;
c) Cura di distribuire i banchi durante le lezioni, assegnando i primi
posti ai nobili e ai dignitari dello Studio;
d) Custodia dei libri che all'uscire dalle lezioni lasciavano gli
scolari [208];
e) Vigilanza segreta sulla condotta dei professori [209].
Una delle professioni assai lucrose nel medio evo era quella dei
copisti. Sebbene in quei tempi il commercio librario fosse quasi
esclusivamente ristretto nelle scuole, nondimeno la necessità di
fornire agli studiosi un numero rilevante di testi, e far circolare le
lezioni dei professori, impiegava l'opera di molte persone. Le
università ammettevano fra i membri della corporazione anche i
copisti concedendo loro parte dei privilegi goduti dagli altri. Il loro
numero era proporzionato a quello degli scolari che frequentavano lo
Studio e alle speranze di guadagno che offriva quell'arte. La quale
non era così semplice come oggidì; ma richiedeva uomini valenti e
bene esercitati, poichè allora il possedere un bel libro e a caro prezzo
era fra i dotti e i potenti un ambito onore.
I copisti dicevansi scribae e molti di essi, erano anche esperti
miniatori. Talvolta un copista veniva destinato ad un solo genere di
lavori nell'arte sua. In Padova si ha memoria di un tale che era
addetto soltanto a copiare i diplomi di laurea, e ornarli di miniature.
E per assicurargli una conveniente retribuzione, l'università stabilì un
prezzo fisso per ogni lavoro che gli veniva affidato [210].
Si conoscevano nel medio evo diversi generi di scrittura. Vi era la
scrittura parigina (litera parisina), la bolognese (bononiensis), la
beneventana (beneventana), l'inglese (anglicana), la lombarda
(lombarda) e l'aretina (aretina). La scrittura distinguevasi anche in
vecchia e nuova (litera nova et antiqua). I libri copiati con caratteri
moderni erano di maggior valore.
Gli statuti, per evitare una dannosa concorrenza fra i copisti,
proibivano agli scolari di somministrare lavoro ad un copista che
avesse contratto un impegno precedente. Si faceva però eccezione
per il caso che il lavoro intrapreso non occupasse un termine
superiore a dieci giorni.
La dimensione di ogni manoscritto era determinata con due voci
distinte, cioè Quaternus e Pecia o Petia.
Il quaderno era ordinariamente composto di sedici pagine, ma
poteva variare secondo la grandezza della carta e del carattere.
La pecia era la misura che serviva a valutare il prezzo del
manoscritto. Questa pecia era composta di sedici colonne, ognuna
delle quali doveva contenere sessantadue linee, e ciascuna linea
trentadue lettere.
Nel catalogo degli Stazionari dell'università di Bologna il nolo di
ciascuna pecia non supera i diciotto soldi. Troviamo, per esempio,
tassato a diciotto soldi l'Apparato delle Decretali, il Digesto antico, i
Decreti; diciassette soldi il testo del Codice e l'Inforziato, e
l'Apparatus Dig. veteris; quindici l'Apparatus Inforziati. Dopo i libri di
testo, diminuiva il prezzo del nolo fino a quattro denari. Fra le opere
che godevano maggior credito e diffusione, troviamo ricordate: le
Somme di Azone (soldi quindici); il libellus Rofredi in Jure civili (soldi
quattordici); le letture di Odofredo (soldi dieci) [211].
L'arte di copiare era esercitata anche dalle donne. Nell'università di
Bologna fra i copisti e miniatori si trovano ricordati molti toscani
specialmente aretini, i quali avevano acquistato molta rinomanza nel
colorire i libri e miniarli con fregi d'oro.
Ben presto divenne così generale e frequente l'uso di ornare i libri,
che in certe scuole dovendo i professori trasportare i loro volumi
avevano bisogno di un servo.
Odofredo parlando dei copisti del suo tempo dice che potevano esser
chiamati veri pittori [212]. E lo stesso scrittore parla anche di un tale
dei suoi tempi che mandato da suo padre a studiare a Parigi
coll'assegno di cento lire, le spendeva tutte pazzamente per fare
ornare e dipingere i suoi libri e nel comprarsi ciascun sabato una
nuova calzatura [213].
Essendo i libri rari e costosi erano tenuti nelle disposizioni
testamentarie fra gli oggetti di maggior valore, specialmente se
erano quelli appartenuti a qualche dottore famoso e sui quali aveva
fatte le sue lezioni.
Nel testamento del giureconsulto Francesco Accursio fra le altre
disposizioni si trova la seguente: «Lascia a Francesco figliuolo di
Dota sua figliuola e moglie di M. Diotalco da Lojano i suoi libri di
leggi, la somma di Azone e il libello di Rofredo, intendendo però i
libri di legge che erano a suo uso speciale, e eccettuando il Codice e
Digesto paterno sopra i quali ordinariamente leggeva esso testatore,
non volendo però che gli abbia se non quando comincerà a udire
nelle scuole; nel qual caso gli lascia ancora lire quaranta per sette
anni continui, per la spesa delle scuole, e in caso che detto
Francesco sia licenziato in legge e riceva i libri, gli lascia i vestimenti
nuovi di scarlatto con li varrj e lire quaranta per il banchetto [214].»
CAPITOLO TERZO

Privilegi universitarii — L'Autentica di Federigo I fondamento


dei privilegi scolastici — Immunità concesse alla nazione
tedesca — Giurisdizione civile e criminale concessa ai
dottori sugli scolari — Privilegio della cittadinanza —
Esenzione dal servizio militare — Esenzione dalle imposte
e gabelle — Inviolabilità personale e degli averi —
Banche di prestito per gli scolari — Abitazioni riserbate
agli scolari — Altri privilegi secondarii.

Coll'Autentica Habita promulgata da Federico I nella Dieta di


Roncaglia nell'anno 1158, ebbero origine i privilegi scolastici delle
persone che facevano parte delle università.
Prima di questa concessione imperiale le università non erano
legalmente riconosciute, nè godevano di alcuna personalità civile.
La legislazione scolastica del medio evo si informò a questa autentica
e gli statuti universitarii vi attinsero i loro principii e le fondamentali
disposizioni.
Però è da avvertire che Federico sanzionando quella sua
costituzione, intese di favorire l'università bolognese e specialmente
la classe dei giureconsulti, i quali avevano dato un responso
favorevole alle sue ambiziose aspirazioni di dominio universale.
I dottori bolognesi applicando soltanto a sè la concessione di quelle
franchigie, vedevano di mal'occhio che le altre università, che
cominciavano allora a propagarsi in Italia, ne partecipassero. Nel
secolo XII fu sollevata la questione dai giureconsulti di Bologna in
occasione che Pillio loro compagno, ad onta del giuramento prestato
si recò ad insegnare nello Studio di Modena. Di questa divergenza si
trova fatta menzione nei Commentari di Odofredo, il quale parlando
di quelli che secondo l'autentica doveano essere esclusi dall'uffizio di
tutori, apertamente dichiara che a parer suo non vi dovessero esser
compresi altro che i professori bolognesi [215]. Il libero esercizio di
questi privilegi passò in seguito anche agli artisti i quali emancipatisi
dalla dipendenza dell'università delle leggi, poterono compilare i
propri statuti e creare magistrati di loro scelta.
Il godimento di questi privilegi non era però comune a tutte le
persone che facevano parte dell'università: ve ne erano alcune che a
rigore dell'autentica imperiale, testè ricordata, non erano ammessi a
risentirne ugualmente i vantaggi. I forestieri (advenae forenses) [216]
erano soltanto i privilegiati, e ragionevolmente, perchè dovendo essi
abitare in una città, che non era la loro patria, per tutto il tempo
necessario a compire gli studii, sarebbero stati esposti alle ingiurie e
alle vendette dei cittadini se una legge speciale non li avesse
protetti.
Lo statuto dell'università di Bologna specifica quali erano le persone
ammesse al godimento dei privilegi universitarii secondo l'ordine del
loro grado, cioè:
I matricolati — così chiamavansi tutti coloro che erano iscritti nella
matricola universitaria.
I dottori che avevano prestato giuramento.
I notari, i bidelli generali e speciali, i famigli dei dottori giurati e degli
scolari, i miniatori, i copisti, i legatori di libri, i venditori di carta e in
generale tutti coloro addetti al servizio dell'università e delle persone
che ne facevano parte. Oltre ai già citati, godevano di tutti i privilegi
gli scolari poveri che vivevano a spese altrui, e i ripetitori.
Ecco la rubrica dello Statuto bolognese:
Qui gaudere debeant privilegio
universitatis nostrae
(Lib. III, pag. 64).
Statuimus q. privilegiis nostrae universitatis gaudeant
seu gaudere debeant matriculati, matriculatos autem
inteligi volumus illos qui in matricula fuerint descripti
secundum formam traditam in titulo de massariis. Item
doctores duntaxat qui iuraverit Rectoribus secundum
formam statutorum loquentium de juramento
doctorum nec non notar, et bidelli generales ac etiam
speciales et famuli scolarium et doctorum iuratorum. §
Item miniatores, scriptores, ligatores librorum cartularii
et omnes illi qui deputati fuerint quoquomodo ad
servitia universitatis et singulorum de universitate. §
Quod intelligimus si corporale subierint sacramentum
secundum formam nostrorum praesentium statutorum.
§ Volumus etiam omnes scolares viventes sumptibus
alienis in studio bononiensi ut sunt socii doctorum
bonon. et scolarium bonon. repetitores et similes,
gaudere debere omnibus privilegiis nostrae
universitatis.

· · · · · · · · · · · · · · · ·

Per godere dei privilegi universitarii era necessario essere scolari,


cioè iscritti regolarmente nelle matricole, e pagare una tassa annua
prestando giuramento di obbedienza al Rettore ed agli statuti. Gli
scolari del luogo dove risiedeva l'università non erano compresi nei
registri perchè i diritti della cittadinanza accademica erano riserbati
esclusivamente agli stranieri come testè abbiamo detto.
È assai malagevole perciò il desumere dai documenti, dal tempo e
dagli scrittori, la cifra esatta degli scolari che frequentavano le
università italiane nei tempi di mezzo.
Fra le nazioni comprese nelle università, era sopra di tutte
privilegiata quella degli scolari tedeschi e ciò forse in omaggio
all'autorità imperiale.
A differenza degli altri studenti, i tedeschi potevano prestare
giuramento ai loro Procuratori e non al Rettore come prescrivevano
gli statuti.
In Bologna la nazione tedesca aveva la facoltà esclusiva di eleggere
il Rettore degli oltramontani.
In Padova dove i tedeschi erano in maggior numero, i privilegi erano
anche più estesi. Gli scolari di quella nazione potevano iscriversi
presso i loro consiglieri, ed uno di questi era chiamato a sostituire il
sindaco dell'università quando era vacante quell'ufficio. Inoltre questi
consiglieri disponevano di voto doppio nelle assemblee [217]. Nel
1609 nella stessa università i consiglieri tedeschi ottennero il
privilegio di allontanarsi senza andar soggetti alla multa come quelli
delle altre nazioni.
Allo scopo di proteggere gli scolari tedeschi, nel 1633 furono
nominati due protettori, i quali, sebbene nati nella città, furono
nondimeno investiti di tutti i privilegi come fossero stati
stranieri [218].
Il numero esatto dei privilegi concessi ai membri che facevano parte
delle università nel medio evo non può essere con certezza
determinato.
In quei tempi di viva emulazione, tutte le città d'Italia allora
costituite a repubblica, gareggiavano fra loro per fondare le
università le quali non solo davano incremento alla scienza, ma
accrescevano ancora la prosperità materiale e la diffusione della
ricchezza pubblica.
Il sorgere di una università portava seco molte sorgenti di entrata e
quanto più numerosi erano gli accorrenti, tanto maggiori erano i
vantaggi e più lauti i guadagni. Tutte le città nei Decreti di
fondazione dei loro Studi dichiaravano di conferire i privilegi e le
immunità, nelle quali largheggiavano sempre per attirare a sè una
gran moltitudine di dottori e di scolari.
Troppo lungo sarebbe lo andare enumerando tutti i singoli privilegi e
le speciali franchigie che ognuna delle nostre antiche università
nell'atto della sua costituzione e in seguito ancora, andava
concedendo a favore di quelli che vi accorrevano per ragione di
studio.
Chi volesse maggiori particolari, e più diffuse notizie su questo
argomento, può rivolgersi ai numerosi storici e cronisti che ne fanno
parola; da cui noi ci siamo dati cura di riassumere i principali
privilegi; e quelli sopratutto che abbiamo riscontrato essere stati
comuni a tutte le università, e per antica consuetudine riconosciuti e
sanzionati in tutti i loro statuti.
Il privilegio che può dirsi fondamentale nella costituzione organica
delle università, e dal quale dipendeva in gran parte la loro
autonomia, era la speciale giurisdizione affidata per l'autentica
imperiale ai magistrati del corpo scolastico. Con questa concessione
si riconosceva nella legale rappresentanza accademica del Rettore e
dei professori la facoltà illimitata di poter decidere tanto nelle
controversie civili, come giudicare nei delitti che per avventura
fossero stati commessi dai membri che facevano parte
dell'università, sì nel recinto delle scuole, come pure al di fuori.
La giurisdizione civile si mantenne per lungo tempo inalterata e non
incontrò ostacoli nel suo esercizio: non così la criminale.
Verso la fine del secolo XII si trova ricordato nelle storie che
essendosi abbandonati gli scolari ad atti di violenza, i professori che
erano stati fino a quel tempo i loro giudici ordinari, si dichiararono
incapaci di frenarne gli abusi, e abbandonarono l'esercizio del
magistero penale. Nella metà del secolo decimoterzo i dottori
ripresero l'uso della giurisdizione criminale; ma la loro autorità in
questa materia non fu giammai pienamente riconosciuta; nè essi
medesimi, a quel che sembra, si curavano di farla rispettare.
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!

ebookultra.com

You might also like