From 6de3f1fb4e3160d0ab8f986ebe9287ce1a19aab0 Mon Sep 17 00:00:00 2001 From: Ilya Zayats Date: Sat, 26 Feb 2011 07:49:50 +0300 Subject: added information about TEST_DIR env variable --- railties/guides/source/contributing_to_ruby_on_rails.textile | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'railties/guides') diff --git a/railties/guides/source/contributing_to_ruby_on_rails.textile b/railties/guides/source/contributing_to_ruby_on_rails.textile index 1977f8d0ce..e00b26f948 100644 --- a/railties/guides/source/contributing_to_ruby_on_rails.textile +++ b/railties/guides/source/contributing_to_ruby_on_rails.textile @@ -101,6 +101,14 @@ $ cd actionpack $ rake test +If you want to run tests from the specific directory use the +TEST_DIR+ environment variable. For example, this will run tests inside +railties/test/generators+ directory only: + + +$ cd railties +$ TEST_DIR=generators rake test + + + h4. Warnings The test suite runs with warnings enabled. Ideally Ruby on Rails should issue no warning, but there may be a few, and also some from third-party libraries. Please ignore (or fix!) them if any, and submit patches that do not issue new warnings. -- cgit v1.2.3 From e331ec0952bb199345d2f77a089abf9cd4f44240 Mon Sep 17 00:00:00 2001 From: Ben Orenstein Date: Sat, 26 Feb 2011 13:28:40 -0500 Subject: Warn people that these methods are deprecated. --- railties/guides/source/active_support_core_extensions.textile | 2 ++ 1 file changed, 2 insertions(+) (limited to 'railties/guides') diff --git a/railties/guides/source/active_support_core_extensions.textile b/railties/guides/source/active_support_core_extensions.textile index 788c243d2a..4074eac7e7 100644 --- a/railties/guides/source/active_support_core_extensions.textile +++ b/railties/guides/source/active_support_core_extensions.textile @@ -1045,6 +1045,8 @@ NOTE: Defined in +active_support/core_ext/class/attribute_accessors.rb+. h4. Class Inheritable Attributes +WARNING: Class Inheritable Attributes are deprecated. It's recommended that you use +Class#class_attribute+ instead. + Class variables are shared down the inheritance tree. Class instance variables are not shared, but they are not inherited either. The macros +class_inheritable_reader+, +class_inheritable_writer+, and +class_inheritable_accessor+ provide accessors for class-level data which is inherited but not shared with children: -- cgit v1.2.3 From 72ae724485cb092870dc9914a4f95aa6fbeda7fa Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Sun, 27 Feb 2011 02:14:30 +0530 Subject: use resources in place of map.resources --- railties/guides/source/generators.textile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'railties/guides') diff --git a/railties/guides/source/generators.textile b/railties/guides/source/generators.textile index 41a96b487d..fc7b1216d5 100644 --- a/railties/guides/source/generators.textile +++ b/railties/guides/source/generators.textile @@ -345,7 +345,7 @@ $ rails generate scaffold Comment body:text invoke shoulda create test/unit/comment_test.rb create test/fixtures/comments.yml - route map.resources :comments + route resources :comments invoke scaffold_controller create app/controllers/comments_controller.rb invoke erb -- cgit v1.2.3 From 9b35eeec6271d341f6fbc64b3515516905d9883e Mon Sep 17 00:00:00 2001 From: Ben Orenstein Date: Sat, 26 Feb 2011 19:07:35 -0500 Subject: Clean up wording. --- railties/guides/source/active_support_core_extensions.textile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'railties/guides') diff --git a/railties/guides/source/active_support_core_extensions.textile b/railties/guides/source/active_support_core_extensions.textile index 4074eac7e7..7becefee09 100644 --- a/railties/guides/source/active_support_core_extensions.textile +++ b/railties/guides/source/active_support_core_extensions.textile @@ -2011,7 +2011,7 @@ That syntactic sugar is used a lot in Rails to avoid positional arguments where If a method expects a variable number of arguments and uses * in its declaration, however, such an options hash ends up being an item of the array of arguments, where it loses its role. -In those cases, you may give an options hash a distinguished treatment with +extract_options!+. That method checks the type of the last item of an array. If it is a hash it pops it and returns it, otherwise returns an empty hash. +In those cases, you may give an options hash a distinguished treatment with +extract_options!+. This method checks the type of the last item of an array. If it is a hash it pops it and returns it, otherwise it returns an empty hash. Let's see for example the definition of the +caches_action+ controller macro: -- cgit v1.2.3 From 6ff10c17aa6955c1e7c6b3ce17f01f80649abf2b Mon Sep 17 00:00:00 2001 From: Rodrigo Navarro Date: Sun, 27 Feb 2011 10:03:50 -0800 Subject: Pointing out that dynamic_form plugin must be installed to be able to use error_messages and error_messages_for view helpers. --- .../source/active_record_validations_callbacks.textile | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'railties/guides') diff --git a/railties/guides/source/active_record_validations_callbacks.textile b/railties/guides/source/active_record_validations_callbacks.textile index 5dc6ef3774..58a184a48e 100644 --- a/railties/guides/source/active_record_validations_callbacks.textile +++ b/railties/guides/source/active_record_validations_callbacks.textile @@ -738,7 +738,20 @@ person.errors.size # => 0 h3. Displaying Validation Errors in the View -Rails provides built-in helpers to display the error messages of your models in your view templates. +Rails maintains an official plugin that provides helpers to display the error messages of your models in your view templates. You can install it as a plugin or as a Gem. + +h4. Installing as a plugin + +$ rails plugin install git://github.com/rails/dynamic_form.git + + +h4 Installing as a Gem +Add this line on your Gemfile: + +gem "dynamic_form" + + +Now you will have access to these two methods in your view templates: h4. +error_messages+ and +error_messages_for+ -- cgit v1.2.3 From 819762c90f9f49e92dd555a89f0e865f9bab9838 Mon Sep 17 00:00:00 2001 From: Lars Smit Date: Mon, 28 Feb 2011 12:17:26 +0100 Subject: Added some new advice on applying patches --- .../guides/source/contributing_to_ruby_on_rails.textile | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'railties/guides') diff --git a/railties/guides/source/contributing_to_ruby_on_rails.textile b/railties/guides/source/contributing_to_ruby_on_rails.textile index e00b26f948..9739da2666 100644 --- a/railties/guides/source/contributing_to_ruby_on_rails.textile +++ b/railties/guides/source/contributing_to_ruby_on_rails.textile @@ -351,6 +351,20 @@ $ git format-patch master --stdout > my_new_patch.diff Sanity check the results of this operation: open the diff file in your text editor of choice and make sure that no unintended changes crept in. +You can check your patches by applying your patch to an different dedicated branch: + + +$ git checkout -b testing_branch +$ git apply --check my_new_patch.diff + + +You can make sure your patches don't add any whitespace by applying it yourself using the --whitespace=error-all option. Make sure you are on your dedicated test branche and: + + +$ git apply --whitespace=error-all mynew_patch.diff + + + h4. Create a Lighthouse Ticket Now create a ticket with your patch. Go to the "new ticket":http://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/new page at Lighthouse. Fill in a reasonable title and description, remember to attach your patch file, and tag the ticket with the ‘patch’ tag and whatever other subject area tags make sense. -- cgit v1.2.3 From 4c9626664f7cf2549939466e9c0e1f5853948111 Mon Sep 17 00:00:00 2001 From: Dalibor Nasevic Date: Tue, 1 Mar 2011 01:16:30 +0100 Subject: Removed link to un-existing Issues page on Github --- railties/guides/source/layout.html.erb | 3 --- 1 file changed, 3 deletions(-) (limited to 'railties/guides') diff --git a/railties/guides/source/layout.html.erb b/railties/guides/source/layout.html.erb index e924f2f6c0..f2681c6461 100644 --- a/railties/guides/source/layout.html.erb +++ b/railties/guides/source/layout.html.erb @@ -127,9 +127,6 @@ <%= link_to 'Ruby on Rails Guides Guidelines', 'ruby_on_rails_guides_guidelines.html' %> for style and conventions.

-

- Issues may also be reported in <%= link_to 'Github', 'https://github.com/lifo/docrails/issues' %>. -

And last but not least, any kind of discussion regarding Ruby on Rails documentation is very welcome in the <%= link_to 'rubyonrails-docs mailing list', 'http://groups.google.com/group/rubyonrails-docs' %>.

-- cgit v1.2.3 From f44e0e82717062b3043a9ce65a8274f338817c83 Mon Sep 17 00:00:00 2001 From: tashian Date: Thu, 3 Mar 2011 15:04:39 -0800 Subject: Properly escaped a + in the dynamic segments TIP --- railties/guides/source/routing.textile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'railties/guides') diff --git a/railties/guides/source/routing.textile b/railties/guides/source/routing.textile index d214031b31..c447fd911a 100644 --- a/railties/guides/source/routing.textile +++ b/railties/guides/source/routing.textile @@ -391,7 +391,7 @@ NOTE: You can't use +namespace+ or +:module+ with a +:controller+ path segment. match ':controller(/:action(/:id))', :controller => /admin\/[^\/]+/
-TIP: By default dynamic segments don't accept dots - this is because the dot is used as a separator for formatted routes. If you need to use a dot within a dynamic segment add a constraint which overrides this - for example +:id => /[^\/]+/+ allows anything except a slash. +TIP: By default dynamic segments don't accept dots - this is because the dot is used as a separator for formatted routes. If you need to use a dot within a dynamic segment add a constraint which overrides this - for example +:id => /[^\/]/+ allows anything except a slash. h4. Static Segments -- cgit v1.2.3 From 22faa2c86d07711221732960b1ccf30b176116c5 Mon Sep 17 00:00:00 2001 From: Akira Matsuda Date: Sun, 6 Mar 2011 03:29:23 +0900 Subject: wrong SQL statement --- railties/guides/source/active_record_querying.textile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'railties/guides') diff --git a/railties/guides/source/active_record_querying.textile b/railties/guides/source/active_record_querying.textile index 64a68f7592..ed3968e226 100644 --- a/railties/guides/source/active_record_querying.textile +++ b/railties/guides/source/active_record_querying.textile @@ -420,7 +420,7 @@ Client.limit(5).offset(30) will return instead a maximum of 5 clients beginning with the 31st. The SQL looks like: -SELECT * FROM clients LIMIT 5, 30 +SELECT * FROM clients LIMIT 5 OFFSET 30 h3. Group -- cgit v1.2.3