railties 3.0.0.beta3 → 3.0.0.beta4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. data/CHANGELOG +5 -0
  2. data/README +118 -123
  3. data/guides/source/3_0_release_notes.textile +13 -11
  4. data/guides/source/action_controller_overview.textile +2 -2
  5. data/guides/source/action_mailer_basics.textile +70 -26
  6. data/guides/source/action_view_overview.textile +1 -1
  7. data/guides/source/active_record_basics.textile +9 -1
  8. data/guides/source/active_record_querying.textile +2 -2
  9. data/guides/source/active_support_core_extensions.textile +377 -9
  10. data/guides/source/activerecord_validations_callbacks.textile +98 -55
  11. data/guides/source/association_basics.textile +1 -1
  12. data/guides/source/caching_with_rails.textile +1 -1
  13. data/guides/source/command_line.textile +23 -23
  14. data/guides/source/configuring.textile +1 -3
  15. data/guides/source/contribute.textile +27 -28
  16. data/guides/source/credits.html.erb +4 -4
  17. data/guides/source/debugging_rails_applications.textile +2 -2
  18. data/guides/source/form_helpers.textile +7 -6
  19. data/guides/source/generators.textile +19 -29
  20. data/guides/source/getting_started.textile +106 -49
  21. data/guides/source/i18n.textile +27 -27
  22. data/guides/source/index.html.erb +18 -8
  23. data/guides/source/initialization.textile +140 -514
  24. data/guides/source/layout.html.erb +6 -4
  25. data/guides/source/layouts_and_rendering.textile +5 -5
  26. data/guides/source/migrations.textile +7 -3
  27. data/guides/source/nested_model_forms.textile +2 -2
  28. data/guides/source/performance_testing.textile +11 -12
  29. data/guides/source/plugins.textile +30 -30
  30. data/guides/source/rails_application_templates.textile +3 -3
  31. data/guides/source/rails_on_rack.textile +3 -66
  32. data/guides/source/routing.textile +10 -4
  33. data/guides/source/security.textile +1 -1
  34. data/guides/source/testing.textile +55 -52
  35. data/guides/w3c_validator.rb +67 -0
  36. data/lib/rails.rb +1 -0
  37. data/lib/rails/application.rb +49 -13
  38. data/lib/rails/application/bootstrap.rb +7 -6
  39. data/lib/rails/application/configuration.rb +24 -47
  40. data/lib/rails/application/finisher.rb +8 -3
  41. data/lib/rails/backtrace_cleaner.rb +11 -12
  42. data/lib/rails/commands.rb +54 -54
  43. data/lib/rails/commands/application.rb +7 -2
  44. data/lib/rails/commands/{performance/benchmarker.rb → benchmarker.rb} +0 -0
  45. data/lib/rails/commands/dbconsole.rb +4 -3
  46. data/lib/rails/commands/destroy.rb +1 -0
  47. data/lib/rails/commands/generate.rb +1 -0
  48. data/lib/rails/commands/{performance/profiler.rb → profiler.rb} +0 -0
  49. data/lib/rails/commands/runner.rb +4 -2
  50. data/lib/rails/configuration.rb +36 -0
  51. data/lib/rails/engine.rb +24 -24
  52. data/lib/rails/engine/configuration.rb +0 -1
  53. data/lib/rails/generators.rb +48 -10
  54. data/lib/rails/generators/actions.rb +5 -3
  55. data/lib/rails/generators/base.rb +23 -17
  56. data/lib/rails/generators/erb/scaffold/templates/_form.html.erb +9 -8
  57. data/lib/rails/generators/erb/scaffold/templates/show.html.erb +1 -1
  58. data/lib/rails/generators/generated_attribute.rb +7 -6
  59. data/lib/rails/generators/rails/app/USAGE +2 -2
  60. data/lib/rails/generators/rails/app/app_generator.rb +242 -97
  61. data/lib/rails/generators/rails/app/templates/Gemfile +3 -0
  62. data/lib/rails/generators/rails/app/templates/README +167 -130
  63. data/lib/rails/generators/rails/app/templates/Rakefile +0 -3
  64. data/lib/rails/generators/rails/app/templates/config/boot.rb +9 -2
  65. data/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml +5 -5
  66. data/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt +4 -0
  67. data/lib/rails/generators/rails/app/templates/script/rails +2 -5
  68. data/lib/rails/generators/rails/generator/templates/%file_name%_generator.rb.tt +1 -3
  69. data/lib/rails/generators/rails/stylesheets/templates/scaffold.css +5 -9
  70. data/lib/rails/generators/test_case.rb +12 -0
  71. data/lib/rails/generators/test_unit/integration/templates/integration_test.rb +1 -1
  72. data/lib/rails/generators/test_unit/performance/templates/performance_test.rb +1 -1
  73. data/lib/rails/info.rb +0 -33
  74. data/lib/rails/log_subscriber.rb +13 -6
  75. data/lib/rails/rack/logger.rb +4 -3
  76. data/lib/rails/railtie.rb +4 -0
  77. data/lib/rails/railtie/configuration.rb +21 -4
  78. data/lib/rails/tasks/documentation.rake +2 -0
  79. data/lib/rails/tasks/framework.rake +22 -0
  80. data/lib/rails/tasks/middleware.rake +1 -1
  81. data/lib/rails/tasks/routes.rake +5 -1
  82. data/lib/rails/test_help.rb +3 -1
  83. data/lib/rails/test_unit/testing.rake +3 -1
  84. data/lib/rails/version.rb +1 -1
  85. metadata +12 -19
  86. data/lib/rails/application/metal_loader.rb +0 -50
  87. data/lib/rails/dispatcher.rb +0 -24
  88. data/lib/rails/generators/rails/mailer/USAGE +0 -15
  89. data/lib/rails/generators/rails/mailer/mailer_generator.rb +0 -14
  90. data/lib/rails/generators/rails/mailer/templates/mailer.rb +0 -16
  91. data/lib/rails/generators/rails/metal/USAGE +0 -8
  92. data/lib/rails/generators/rails/metal/metal_generator.rb +0 -11
  93. data/lib/rails/generators/rails/metal/templates/metal.rb +0 -12
@@ -115,17 +115,17 @@ end
115
115
  >> p = Person.new
116
116
  => #<Person id: nil, name: nil>
117
117
  >> p.errors
118
- => #<ActiveRecord::Errors..., @errors={}>
118
+ => {}
119
119
 
120
120
  >> p.valid?
121
121
  => false
122
122
  >> p.errors
123
- => #<ActiveRecord::Errors..., @errors={"name"=>["can't be blank"]}>
123
+ => {:name=>["can't be blank"]}
124
124
 
125
125
  >> p = Person.create
126
126
  => #<Person id: nil, name: nil>
127
127
  >> p.errors
128
- => #<ActiveRecord::Errors..., @errors={"name"=>["can't be blank"]}>
128
+ => {:name=>["can't be blank"]}
129
129
 
130
130
  >> p.save
131
131
  => false
@@ -139,17 +139,19 @@ end
139
139
 
140
140
  +invalid?+ is simply the inverse of +valid?+. +invalid?+ triggers your validations and returns true if any errors were added to the object, and false otherwise.
141
141
 
142
- h4. +errors.invalid?+
142
+ h4(#validations_overview-errors). +errors[]+
143
143
 
144
- To verify whether or not a particular attribute of an object is valid, you can use the +errors.invalid?+ method. This method is only useful _after_ validations have been run, because it only inspects the errors collection and does not trigger validations itself. It's different from the +ActiveRecord::Base#invalid?+ method explained above because it doesn't verify the validity of the object as a whole. It only checks to see whether there are errors found on an individual attribute of the object.
144
+ To verify whether or not a particular attribute of an object is valid, you can use +errors[:attribute]+ that returns an array with all attribute errors, when there are no errors on the specified attribute, an empty array is returned.
145
+
146
+ This method is only useful _after_ validations have been run, because it only inspects the errors collection and does not trigger validations itself. It's different from the +ActiveRecord::Base#invalid?+ method explained above because it doesn't verify the validity of the object as a whole. It only checks to see whether there are errors found on an individual attribute of the object.
145
147
 
146
148
  <ruby>
147
149
  class Person < ActiveRecord::Base
148
150
  validates_presence_of :name
149
151
  end
150
152
 
151
- >> Person.new.errors.invalid?(:name) # => false
152
- >> Person.create.errors.invalid?(:name) # => true
153
+ >> Person.new.errors[:name].any? # => false
154
+ >> Person.create.errors[:name].any? # => true
153
155
  </ruby>
154
156
 
155
157
  We'll cover validation errors in greater depth in the "Working with Validation Errors":#working-with-validation-errors section. For now, let's turn to the built-in validation helpers that Rails provides by default.
@@ -234,7 +236,7 @@ This helper validates that the attributes' values are not included in a given se
234
236
  <ruby>
235
237
  class Account < ActiveRecord::Base
236
238
  validates_exclusion_of :subdomain, :in => %w(www),
237
- :message => "Subdomain {{value}} is reserved."
239
+ :message => "Subdomain %{value} is reserved."
238
240
  end
239
241
  </ruby>
240
242
 
@@ -262,7 +264,7 @@ This helper validates that the attributes' values are included in a given set. I
262
264
  <ruby>
263
265
  class Coffee < ActiveRecord::Base
264
266
  validates_inclusion_of :size, :in => %w(small medium large),
265
- :message => "{{value}} is not a valid size"
267
+ :message => "%{value} is not a valid size"
266
268
  end
267
269
  </ruby>
268
270
 
@@ -290,12 +292,12 @@ The possible length constraint options are:
290
292
  * +:in+ (or +:within+) - The attribute length must be included in a given interval. The value for this option must be a range.
291
293
  * +:is+ - The attribute length must be equal to the given value.
292
294
 
293
- The default error messages depend on the type of length validation being performed. You can personalize these messages using the +:wrong_length+, +:too_long+, and +:too_short+ options and <tt>{{count}}</tt> as a placeholder for the number corresponding to the length constraint being used. You can still use the +:message+ option to specify an error message.
295
+ The default error messages depend on the type of length validation being performed. You can personalize these messages using the +:wrong_length+, +:too_long+, and +:too_short+ options and <tt>%{count}</tt> as a placeholder for the number corresponding to the length constraint being used. You can still use the +:message+ option to specify an error message.
294
296
 
295
297
  <ruby>
296
298
  class Person < ActiveRecord::Base
297
299
  validates_length_of :bio, :maximum => 1000,
298
- :too_long => "{{count}} characters is the maximum allowed"
300
+ :too_long => "%{count} characters is the maximum allowed"
299
301
  end
300
302
  </ruby>
301
303
 
@@ -307,8 +309,8 @@ class Essay < ActiveRecord::Base
307
309
  :minimum => 300,
308
310
  :maximum => 400,
309
311
  :tokenizer => lambda { |str| str.scan(/\w+/) },
310
- :too_short => "must have at least {{count}} words",
311
- :too_long => "must have at most {{count}} words"
312
+ :too_short => "must have at least %{count} words",
313
+ :too_long => "must have at most %{count} words"
312
314
  end
313
315
  </ruby>
314
316
 
@@ -337,11 +339,11 @@ end
337
339
 
338
340
  Besides +:only_integer+, the +validates_numericality_of+ helper also accepts the following options to add constraints to acceptable values:
339
341
 
340
- * +:greater_than+ - Specifies the value must be greater than the supplied value. The default error message for this option is "_must be greater than {{count}}_".
341
- * +:greater_than_or_equal_to+ - Specifies the value must be greater than or equal to the supplied value. The default error message for this option is "_must be greater than or equal to {{count}}_".
342
- * +:equal_to+ - Specifies the value must be equal to the supplied value. The default error message for this option is "_must be equal to {{count}}_".
343
- * +:less_than+ - Specifies the value must be less than the supplied value. The default error message for this option is "_must be less than {{count}}_".
344
- * +:less_than_or_equal_to+ - Specifies the value must be less than or equal the supplied value. The default error message for this option is "_must be less or equal to {{count}}_".
342
+ * +:greater_than+ - Specifies the value must be greater than the supplied value. The default error message for this option is "_must be greater than %{count}_".
343
+ * +:greater_than_or_equal_to+ - Specifies the value must be greater than or equal to the supplied value. The default error message for this option is "_must be greater than or equal to %{count}_".
344
+ * +:equal_to+ - Specifies the value must be equal to the supplied value. The default error message for this option is "_must be equal to %{count}_".
345
+ * +:less_than+ - Specifies the value must be less than the supplied value. The default error message for this option is "_must be less than %{count}_".
346
+ * +:less_than_or_equal_to+ - Specifies the value must be less than or equal the supplied value. The default error message for this option is "_must be less or equal to %{count}_".
345
347
  * +:odd+ - Specifies the value must be an odd number if set to true. The default error message for this option is "_must be odd_".
346
348
  * +:even+ - Specifies the value must be an even number if set to true. The default error message for this option is "_must be even_".
347
349
 
@@ -469,7 +471,7 @@ The +:allow_nil+ option skips the validation when the value being validated is +
469
471
  <ruby>
470
472
  class Coffee < ActiveRecord::Base
471
473
  validates_inclusion_of :size, :in => %w(small medium large),
472
- :message => "{{value}} is not a valid size", :allow_nil => true
474
+ :message => "%{value} is not a valid size", :allow_nil => true
473
475
  end
474
476
  </ruby>
475
477
 
@@ -595,21 +597,53 @@ In addition to the +valid?+ and +invalid?+ methods covered earlier, Rails provid
595
597
 
596
598
  The following is a list of the most commonly used methods. Please refer to the +ActiveRecord::Errors+ documentation for a list of all the available methods.
597
599
 
598
- h4. +errors.add_to_base+
600
+ h4(#working_with_validation_errors-errors). +errors+
599
601
 
600
- The +add_to_base+ method lets you add errors messages that are related to the object's state as a whole, instead of being related to a specific attribute. You can use this method when you want to say that the object is invalid, no matter the values of its attributes. +add_to_base+ simply receives a string and uses this as the error message.
602
+ Returns an OrderedHash with all errors. Each key is the attribute name and value is an array of strings with all errors.
601
603
 
602
604
  <ruby>
603
605
  class Person < ActiveRecord::Base
604
- def a_method_used_for_validation_purposes
605
- errors.add_to_base("This person is invalid because ...")
606
- end
606
+ validates_presence_of :name
607
+ validates_length_of :name, :minimum => 3
608
+ end
609
+
610
+ person = Person.new
611
+ person.valid? # => false
612
+ person.errors
613
+ # => {:name => ["can't be blank", "is too short (minimum is 3 characters)"]}
614
+
615
+ person = Person.new(:name => "John Doe")
616
+ person.valid? # => true
617
+ person.errors # => []
618
+ </ruby>
619
+
620
+ h4(#working_with_validation_errors-errors-2). +errors[]+
621
+
622
+ +errors[]+ is used when you want to check the error messages for a specific attribute. It returns an array of strings with all error messages for the given attribute, each string with one error message. If there are no errors related to the attribute returns an empty array.
623
+
624
+ <ruby>
625
+ class Person < ActiveRecord::Base
626
+ validates_presence_of :name
627
+ validates_length_of :name, :minimum => 3
607
628
  end
629
+
630
+ person = Person.new(:name => "John Doe")
631
+ person.valid? # => true
632
+ person.errors[:name] # => []
633
+
634
+ person = Person.new(:name => "JD")
635
+ person.valid? # => false
636
+ person.errors[:name] # => ["is too short (minimum is 3 characters)"]
637
+
638
+ person = Person.new
639
+ person.valid? # => false
640
+ person.errors[:name]
641
+ # => ["can't be blank", "is too short (minimum is 3 characters)"]
608
642
  </ruby>
609
643
 
610
644
  h4. +errors.add+
611
645
 
612
- The +add+ method lets you manually add messages that are related to particular attributes. You can use the +full_messages+ method to view the messages in the form they might be displayed to a user. Those particular messages get the attribute name prepended (and capitalized). +add+ receives the name of the attribute you want to add the message to, and the message itself.
646
+ The +add+ method lets you manually add messages that are related to particular attributes. You can use the +errors.full_messages+ or +errors.to_a+ methods to view the messages in the form they might be displayed to a user. Those particular messages get the attribute name prepended (and capitalized). +add+ receives the name of the attribute you want to add the message to, and the message itself.
613
647
 
614
648
  <ruby>
615
649
  class Person < ActiveRecord::Base
@@ -620,37 +654,44 @@ end
620
654
 
621
655
  person = Person.create(:name => "!@#")
622
656
 
623
- person.errors.on(:name)
624
- # => "cannot contain the characters !@#%*()_-+="
657
+ person.errors[:name]
658
+ # => ["cannot contain the characters !@#%*()_-+="]
625
659
 
626
660
  person.errors.full_messages
627
661
  # => ["Name cannot contain the characters !@#%*()_-+="]
628
662
  </ruby>
663
+
664
+ Another way to do this is using +[]=+ setter
629
665
 
630
- h4. +errors.on+
666
+ <ruby>
667
+ class Person < ActiveRecord::Base
668
+ def a_method_used_for_validation_purposes
669
+ errors[:name] = "cannot contain the characters !@#%*()_-+="
670
+ end
671
+ end
672
+
673
+ person = Person.create(:name => "!@#")
674
+
675
+ person.errors[:name]
676
+ # => ["cannot contain the characters !@#%*()_-+="]
677
+
678
+ person.errors.to_a
679
+ # => ["Name cannot contain the characters !@#%*()_-+="]
680
+ </ruby>
681
+
682
+ h4. +errors[:base]+
631
683
 
632
- The +on+ method is used when you want to check the error messages for a specific attribute. It returns different kinds of objects depending on the state of the +errors+ collection for the given attribute. If there are no errors related to the attribute +on+ returns +nil+. If there is just one error message for this attribute +on+ returns a string with the message. When +errors+ holds two or more error messages for the attribute, +on+ returns an array of strings, each one with one error message.
684
+ You can add errors messages that are related to the object's state as a whole, instead of being related to a specific attribute. You can use this method when you want to say that the object is invalid, no matter the values of its attributes. Since +errors[:base]+ is an array, you can simply add a string to the array and uses it as the error message.
633
685
 
634
686
  <ruby>
635
687
  class Person < ActiveRecord::Base
636
- validates_presence_of :name
637
- validates_length_of :name, :minimum => 3
688
+ def a_method_used_for_validation_purposes
689
+ errors[:base] << "This person is invalid because ..."
690
+ end
638
691
  end
692
+ </ruby>
639
693
 
640
- person = Person.new(:name => "John Doe")
641
- person.valid? # => true
642
- person.errors.on(:name) # => nil
643
-
644
- person = Person.new(:name => "JD")
645
- person.valid? # => false
646
- person.errors.on(:name)
647
- # => "is too short (minimum is 3 characters)"
648
694
 
649
- person = Person.new
650
- person.valid? # => false
651
- person.errors.on(:name)
652
- # => ["can't be blank", "is too short (minimum is 3 characters)"]
653
- </ruby>
654
695
 
655
696
  h4. +errors.clear+
656
697
 
@@ -664,7 +705,7 @@ end
664
705
 
665
706
  person = Person.new
666
707
  person.valid? # => false
667
- person.errors.on(:name)
708
+ person.errors[:name]
668
709
  # => ["can't be blank", "is too short (minimum is 3 characters)"]
669
710
 
670
711
  person.errors.clear
@@ -672,7 +713,7 @@ person.errors.empty? # => true
672
713
 
673
714
  p.save # => false
674
715
 
675
- p.errors.on(:name)
716
+ p.errors[:name]
676
717
  # => ["can't be blank", "is too short (minimum is 3 characters)"]
677
718
  </ruby>
678
719
 
@@ -838,32 +879,28 @@ Here is a list with all the available Active Record callbacks, listed in the sam
838
879
  h4. Creating an Object
839
880
 
840
881
  * +before_validation+
841
- * +before_validation_on_create+
842
882
  * +after_validation+
843
- * +after_validation_on_create+
844
883
  * +before_save+
884
+ * +after_save+
845
885
  * +before_create+
846
- * INSERT OPERATION
886
+ * +around_create+
847
887
  * +after_create+
848
- * +after_save+
849
888
 
850
889
  h4. Updating an Object
851
890
 
852
891
  * +before_validation+
853
- * +before_validation_on_update+
854
892
  * +after_validation+
855
- * +after_validation_on_update+
856
893
  * +before_save+
894
+ * +after_save+
857
895
  * +before_update+
858
- * UPDATE OPERATION
896
+ * +around_update+
859
897
  * +after_update+
860
- * +after_save+
861
898
 
862
899
  h4. Destroying an Object
863
900
 
864
901
  * +before_destroy+
865
- * DELETE OPERATION
866
902
  * +after_destroy+
903
+ * +around_destroy+
867
904
 
868
905
  WARNING. +after_save+ runs both on create and update, but always _after_ the more specific callbacks +after_create+ and +after_update+, no matter the order in which the macro calls were executed.
869
906
 
@@ -1075,6 +1112,10 @@ h4. Creating Observers
1075
1112
 
1076
1113
  For example, imagine a +User+ model where we want to send an email every time a new user is created. Because sending emails is not directly related to our model's purpose, we could create an observer to contain this functionality.
1077
1114
 
1115
+ <shell>
1116
+ rails generate observer User
1117
+ </shell>
1118
+
1078
1119
  <ruby>
1079
1120
  class UserObserver < ActiveRecord::Observer
1080
1121
  def after_create(model)
@@ -1121,6 +1162,8 @@ h3. Changelog
1121
1162
 
1122
1163
  "Lighthouse ticket":http://rails.lighthouseapp.com/projects/16213/tickets/26-active-record-validations-and-callbacks
1123
1164
 
1165
+ * May 24, 2010: Fixed document to validate XHTML 1.0 Strict. "Jaime Iniesta":http://jaimeiniesta.com
1166
+ * May 15, 2010: Validation Errors section updated by "Emili Parreño":http://www.eparreno.com
1124
1167
  * March 7, 2009: Callbacks revision by Trevor Turk
1125
1168
  * February 10, 2009: Observers revision by Trevor Turk
1126
1169
  * February 5, 2009: Initial revision by Trevor Turk
@@ -1262,7 +1262,7 @@ end
1262
1262
 
1263
1263
  TIP: In any case, Rails will not create foreign key columns for you. You need to explicitly define them as part of your migrations.
1264
1264
 
1265
- h6(:has_many-group). +:group+
1265
+ h6(#has_many-group). +:group+
1266
1266
 
1267
1267
  The +:group+ option supplies an attribute name to group the result set by, using a +GROUP BY+ clause in the finder SQL.
1268
1268
 
@@ -57,7 +57,7 @@ class ProductsController < ActionController
57
57
  end
58
58
 
59
59
  def create
60
- expire_page :action => :list
60
+ expire_page :action => :index
61
61
  end
62
62
 
63
63
  end
@@ -31,7 +31,7 @@ h4. +rails+
31
31
 
32
32
  The first thing we'll want to do is create a new Rails application by running the +rails+ command after installing Rails.
33
33
 
34
- WARNING: You know you need the rails gem installed by typing +gem install rails+ first, if you don't have this installed, follow the instructions in the "Rails 3 Release Notes":/3_0_release_notes.textile
34
+ WARNING: You know you need the rails gem installed by typing +gem install rails+ first, if you don't have this installed, follow the instructions in the "Rails 3 Release Notes":/3_0_release_notes.html
35
35
 
36
36
  <shell>
37
37
  $ rails commandsapp
@@ -64,12 +64,13 @@ Without any prodding of any kind, +rails server+ will run our new shiny Rails ap
64
64
  <shell>
65
65
  $ cd commandsapp
66
66
  $ rails server
67
- => Booting WEBrick...
68
- => Rails 2.2.0 application started on http://0.0.0.0:3000
69
- => Ctrl-C to shutdown server; call with --help for options
70
- [2008-11-04 10:11:38] INFO WEBrick 1.3.1
71
- [2008-11-04 10:11:38] INFO ruby 1.8.5 (2006-12-04) [i486-linux]
72
- [2008-11-04 10:11:38] INFO WEBrick::HTTPServer#start: pid=18994 port=3000
67
+ => Booting WEBrick
68
+ => Rails 3.0.0 application starting in development on http://0.0.0.0:3000
69
+ => Call with -d to detach
70
+ => Ctrl-C to shutdown server
71
+ [2010-04-18 03:20:33] INFO WEBrick 1.3.1
72
+ [2010-04-18 03:20:33] INFO ruby 1.8.7 (2010-01-10) [x86_64-linux]
73
+ [2010-04-18 03:20:33] INFO WEBrick::HTTPServer#start: pid=26086 port=3000
73
74
  </shell>
74
75
 
75
76
  With just three commands we whipped up a Rails server listening on port 3000. Go to your browser and open "http://localhost:3000":http://localhost:3000, you will see a basic rails app running.
@@ -237,7 +238,7 @@ The migration requires that we *migrate*, that is, run some Ruby code (living in
237
238
 
238
239
  <shell>
239
240
  $ rake db:migrate
240
- (in /Users/mikel/rails_programs/commandsapp)
241
+ (in /home/foobar/commandsapp)
241
242
  == CreateHighScores: migrating ===============================================
242
243
  -- create_table(:high_scores)
243
244
  -> 0.0026s
@@ -320,21 +321,20 @@ h4. +about+
320
321
  Check it: Version numbers for Ruby, RubyGems, Rails, the Rails subcomponents, your application's folder, the current Rails environment name, your app's database adapter, and schema version! +about+ is useful when you need to ask for help, check if a security patch might affect you, or when you need some stats for an existing Rails installation.
321
322
 
322
323
  <shell>
323
- $ rails about
324
+ $ rake about
324
325
  About your application's environment
325
- Ruby version 1.8.6 (i486-linux)
326
- RubyGems version 1.3.1
327
- Rails version 2.2.0
328
- Active Record version 2.2.0
329
- Action Pack version 2.2.0
330
- Active Resource version 2.2.0
331
- Action Mailer version 2.2.0
332
- Active Support version 2.2.0
333
- Edge Rails revision unknown
334
- Application root /home/commandsapp
326
+ Ruby version 1.8.7 (x86_64-linux)
327
+ RubyGems version 1.3.6
328
+ Rack version 1.1
329
+ Rails version 3.0.0
330
+ Active Record version 3.0.0
331
+ Action Pack version 3.0.0
332
+ Active Resource version 3.0.0
333
+ Action Mailer version 3.0.0
334
+ Active Support version 3.0.0
335
+ Middleware ActionDispatch::Static, Rack::Lock, Rack::Runtime, Rails::Rack::Logger, ActionDispatch::ShowExceptions, ActionDispatch::RemoteIp, Rack::Sendfile, ActionDispatch::Callbacks, ActionDispatch::Cookies, ActionDispatch::Session::CookieStore, ActionDispatch::Flash, ActionDispatch::ParamsParser, Rack::MethodOverride, ActionDispatch::Head
336
+ Application root /home/foobar/commandsapp
335
337
  Environment development
336
- Database adapter sqlite3
337
- Database schema version 20081217073400
338
338
  </shell>
339
339
 
340
340
  h3. The Rails Advanced Command Line
@@ -526,11 +526,11 @@ You can get a list of Rake tasks available to you, which will often depend on yo
526
526
 
527
527
  <shell>
528
528
  rake --tasks
529
- (in /home/developer/commandsapp)
529
+ (in /home/foobar/commandsapp)
530
530
  rake db:abort_if_pending_migrations # Raises an error if there are pending migrations
531
531
  rake db:charset # Retrieves the charset for the current environment's database
532
532
  rake db:collation # Retrieves the collation for the current environment's database
533
- rake db:create # Create the database defined in config/database.yml for the current RAILS_ENV
533
+ rake db:create # Create the database defined in config/database.yml for the current Rails.env
534
534
  ...
535
535
  ...
536
536
  rake tmp:pids:clear # Clears all files in tmp/pids
@@ -63,8 +63,6 @@ h4. Rails General Configuration
63
63
 
64
64
  * +config.logger+ accepts a logger conforming to the interface of Log4r or the default Ruby 1.8+ Logger class, which is then used to log information from Action Controller. Set to nil to disable logging.
65
65
 
66
- * +config.metals+ accepts an array used as the metals to load. If this is set to nil, all metals will be loaded in alphabetical order. If this is set to [], no metals will be loaded. Otherwise metals will be loaded in the order specified
67
-
68
66
  * +config.plugin_loader+ overrides the class that handles loading each plugin. Defaults to +Rails::Plugin::Loader+.
69
67
 
70
68
  * +config.plugin_locators+ overrides the class that handle finding the desired plugins that you‘d like to load for your application. By default it is the +Rails::Plugin::FileSystemLocator+.
@@ -163,7 +161,7 @@ WARNING: Threadsafe operation in incompatible with the normal workings of develo
163
161
 
164
162
  The caching code adds two additional settings:
165
163
 
166
- * +ActionController::Base.page_cache_directory+ sets the directory where Rails will create cached pages for your web server. The default is +Rails.public_path+ (which is usually set to +RAILS_ROOT + "/public"+).
164
+ * +ActionController::Base.page_cache_directory+ sets the directory where Rails will create cached pages for your web server. The default is +Rails.public_path+ (which is usually set to +Rails.root + "/public"+).
167
165
 
168
166
  * +ActionController::Base.page_cache_extension+ sets the extension to be used when generating pages for the cache (this is ignored if the incoming request already has an extension). The default is +.html+.
169
167
 
@@ -6,33 +6,37 @@ endprologue.
6
6
 
7
7
  h3. How to Contribute?
8
8
 
9
- * We have an open commit policy: anyone is welcome to contribute, but you'll need to ask for commit access.
10
- * PM lifo at "GitHub":http://github.com asking for "docrails":http://github.com/lifo/docrails/tree/master commit access.
11
- * Guides are written in Textile, and reside at railties/guides/source in the docrails project.
9
+ * We have an open commit policy: anyone is welcome to contribute and to review contributions.
10
+ * "docrails is hosted on GitHub":http://github.com/lifo/docrails and has public write access.
11
+ * Guides are written in Textile, and reside at +railties/guides/source+ in the docrails project.
12
+ * Follow the "Rails Guides Conventions":http://wiki.github.com/lifo/docrails/rails-guides-conventions.
12
13
  * Assets are stored in the +railties/guides/assets+ directory.
13
- * Sample format : "Active Record Associations":http://github.com/lifo/docrails/blob/3e56a3832415476fdd1cb963980d0ae390ac1ed3/railties/guides/source/association_basics.textile
14
- * Sample output : "Active Record Associations":association_basics.html
14
+ * Sample format : "Active Record Associations":http://github.com/lifo/docrails/blob/3e56a3832415476fdd1cb963980d0ae390ac1ed3/railties/guides/source/association_basics.textile.
15
+ * Sample output : "Active Record Associations":association_basics.html.
15
16
  * You can build the Guides during testing by running +rake generate_guides+ in the +railties+ directory.
17
+ * You're encouraged to validate XHTML for the generated guides before commiting your changes by running +rake validate_guides+ in the +railties+ directory.
18
+ * Edge guides "can be consulted online":http://edgeguides.rubyonrails.org/. That website is generated periodically from docrails.
16
19
 
17
20
  h3. What to Contribute?
18
21
 
19
22
  * We need authors, editors, proofreaders, and translators. Adding a single paragraph of quality content to a guide is a good way to get started.
20
23
  * The easiest way to start is by improving an existing guide:
21
- ** Improve the structure to make it more coherent
22
- ** Add missing information
23
- ** Correct any factual errors
24
- ** Fix typos or improve style
25
- ** Bring it up to date with the latest Edge Rails
26
- * We're also open to suggestions for entire new guides
27
- ** Contact lifo or mikeg1a in IRC or via "email":mailto:MikeG1@larkfarm.com to get your idea approved
28
- ** If you're the main author on a significant guide, you're eligible for the prizes
29
-
30
- h3. How to Commit
31
-
32
- * If you have a small change or typo fix, just ask lifo for commit access and commit it to the project.
33
- * If your change is more significant, post a patch or a message on Lighthouse, and commit after you get a +1 from lifo or mikeg1a.
34
- * If the guide is already marked done, you should get a +1 before pushing your changes.
35
- * Put [#&lt;ticket number&gt;] in your commit message to enable GitHub/Lighthouse integration.
24
+ ** Improve the structure to make it more coherent.
25
+ ** Add missing information.
26
+ ** Correct any factual errors.
27
+ ** Fix typos or improve style.
28
+ ** Bring it up to date with the latest Edge Rails.
29
+ * We're also open to suggestions for entire new guides:
30
+ ** Contact lifo or fxn to get your idea approved. See the Contact section below.
31
+ ** If you're the main author on a significant guide, you're eligible for the prizes.
32
+
33
+ h3. How is the process?
34
+
35
+ * The preferred way to contribute is to commit to docrails directly.
36
+ * A new guide is only edited by its author until finished though. In that case feedback can be given in its LH ticket.
37
+ * If you are writing a new guide freely commit to docrails partial work and ping lifo or fxn when done with a first draft.
38
+ * Guides reviewers will then provide feedback, some of it possibly in form of direct commits to agilize the process.
39
+ * Eventually the guide will be approved and added to the index.
36
40
 
37
41
  h3. Prizes
38
42
 
@@ -59,13 +63,8 @@ h3. Mailing List
59
63
 
60
64
  "Ruby on Rails: Documentation":http://groups.google.com/group/rubyonrails-docs is the mailing list for all the guides/documentation related discussions.
61
65
 
62
- h3. IRC Channel
63
-
64
- ==#docrails @ irc.freenode.net==
65
-
66
66
  h3. Contact
67
67
 
68
- If you have any questions or need any clarification, feel free to contact:
69
-
70
- * IRC : lifo, mikeg1a or fxn in #docrails
71
- * Email : pratiknaik aT gmail
68
+ * IRC : #docrails channel in irc.freenode.net
69
+ * Twitter: "@docrails":http://twitter.com/docrails, "@lifo":http://twitter.com/lifo, "@fxn":http://twitter.com/fxn
70
+ * Email : pratiknaik aT gmail, fxn aT hashref dot com