From f00a39845676bd552e31f47f3588ca266d4f010a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Fri, 4 Mar 2011 13:05:27 +0100 Subject: log and readme should respect --quiet --- railties/lib/rails/generators/actions.rb | 7 ++++--- railties/test/generators/actions_test.rb | 25 +++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 3 deletions(-) (limited to 'railties') diff --git a/railties/lib/rails/generators/actions.rb b/railties/lib/rails/generators/actions.rb index d7a86a5c40..c323df3e95 100644 --- a/railties/lib/rails/generators/actions.rb +++ b/railties/lib/rails/generators/actions.rb @@ -264,17 +264,18 @@ module Rails # readme "README" # def readme(path) - say File.read(find_in_source_paths(path)) + log File.read(find_in_source_paths(path)) end protected # Define log for backwards compatibility. If just one argument is sent, - # invoke say, otherwise invoke say_status. + # invoke say, otherwise invoke say_status. Differently from say and + # similarly to say_status, this method respects the quiet? option given. # def log(*args) if args.size == 1 - say args.first.to_s + say args.first.to_s unless options.quiet? else args << (self.behavior == :invoke ? :green : :red) say_status *args diff --git a/railties/test/generators/actions_test.rb b/railties/test/generators/actions_test.rb index 4b29afdc8f..68d4c17623 100644 --- a/railties/test/generators/actions_test.rb +++ b/railties/test/generators/actions_test.rb @@ -191,6 +191,31 @@ class ActionsTest < Rails::Generators::TestCase assert_match(/Welcome to Rails/, action(:readme, "README")) end + def test_readme_with_quiet + generator(default_arguments, :quiet => true) + run_generator + Rails::Generators::AppGenerator.expects(:source_root).times(2).returns(destination_root) + assert_no_match(/Welcome to Rails/, action(:readme, "README")) + end + + def test_log + assert_equal("YES\n", action(:log, "YES")) + end + + def test_log_with_status + assert_equal(" yes YES\n", action(:log, :yes, "YES")) + end + + def test_log_with_quiet + generator(default_arguments, :quiet => true) + assert_equal("", action(:log, "YES")) + end + + def test_log_with_status_with_quiet + generator(default_arguments, :quiet => true) + assert_equal("", action(:log, :yes, "YES")) + end + protected def action(*args, &block) -- cgit v1.2.3 From feec2250bbb53428ae13ea928c68e378447bef81 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') 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 8f526b30f49b8441dc80f00a42a58fc4ab61011a 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') diff --git a/railties/guides/source/active_support_core_extensions.textile b/railties/guides/source/active_support_core_extensions.textile index e0b1bf6e83..8090d16fea 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 e15973ce7c1ea926da38fb5b4a6f2c1b62beaac7 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') 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 eef713dd663dc0381d4a9c5479b3b8f1d254495c 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') diff --git a/railties/guides/source/active_support_core_extensions.textile b/railties/guides/source/active_support_core_extensions.textile index 8090d16fea..1df36137b4 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 3f97f056f9707101a14d0ff43db0866ddc7515c2 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') 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 9b01284c3e20bd667a43b3bae48a92c4d280f4fd 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') 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 3673a6981e06365fc46fd7ebd4a5b0d5f8ee3c6e 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') 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 d735672aa5c73e314345277f001b55d13859303e Mon Sep 17 00:00:00 2001 From: JudeArasu Date: Thu, 3 Mar 2011 23:20:28 +0530 Subject: Spelling mistake --- railties/README.rdoc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'railties') diff --git a/railties/README.rdoc b/railties/README.rdoc index 789d5255b7..0457227473 100644 --- a/railties/README.rdoc +++ b/railties/README.rdoc @@ -4,7 +4,7 @@ Railties is responsible to glue all frameworks together. Overall, it: * handles all the bootstrapping process for a Rails application; -* manager rails command line interface; +* manages rails command line interface; * provides Rails generators core; @@ -23,3 +23,4 @@ Documentation can be found at == License Railties is released under the MIT license. + -- cgit v1.2.3 From e95b965926a11d77aee379d9557ad1bee155dd7a 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') 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 737abe4b4dcf3621d7ba6db7fe5d64d73078bfad Mon Sep 17 00:00:00 2001 From: "R.T. Lechow" Date: Fri, 4 Mar 2011 00:19:58 -0500 Subject: Railties typos. --- railties/lib/rails/engine.rb | 6 +++--- .../rails/generators/rails/plugin_new/templates/test/test_helper.rb | 2 +- railties/lib/rails/generators/resource_helpers.rb | 2 +- railties/lib/rails/railtie/configuration.rb | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) (limited to 'railties') diff --git a/railties/lib/rails/engine.rb b/railties/lib/rails/engine.rb index 7c26234750..50bba22a3a 100644 --- a/railties/lib/rails/engine.rb +++ b/railties/lib/rails/engine.rb @@ -252,12 +252,12 @@ module Rails # end # # The routes above will automatically point to MyEngine::ApplicationContoller. Furthermore, you don't - # need to use longer url helpers like my_engine_articles_path. Instead, you shuold simply use + # need to use longer url helpers like my_engine_articles_path. Instead, you should simply use # articles_path as you would do with your application. # # To make that behaviour consistent with other parts of the framework, an isolated engine also has influence on # ActiveModel::Naming. When you use a namespaced model, like MyEngine::Article, it will normally - # use the prefix "my_engine". In an isolated engine, the prefix will be ommited in url helpers and + # use the prefix "my_engine". In an isolated engine, the prefix will be omitted in url helpers and # form fields for convenience. # # polymorphic_url(MyEngine::Article.new) #=> "articles_path" @@ -266,7 +266,7 @@ module Rails # text_field :title #=> # end # - # Additionaly isolated engine will set its name according to namespace, so + # Additionally isolated engine will set its name according to namespace, so # MyEngine::Engine.engine_name #=> "my_engine". It will also set MyEngine.table_name_prefix # to "my_engine_", changing MyEngine::Article model to use my_engine_article table. # diff --git a/railties/lib/rails/generators/rails/plugin_new/templates/test/test_helper.rb b/railties/lib/rails/generators/rails/plugin_new/templates/test/test_helper.rb index 791b901593..dcd3b276e3 100644 --- a/railties/lib/rails/generators/rails/plugin_new/templates/test/test_helper.rb +++ b/railties/lib/rails/generators/rails/plugin_new/templates/test/test_helper.rb @@ -1,4 +1,4 @@ -# Configure Rails Envinronment +# Configure Rails Environment ENV["RAILS_ENV"] = "test" require File.expand_path("../dummy/config/environment.rb", __FILE__) diff --git a/railties/lib/rails/generators/resource_helpers.rb b/railties/lib/rails/generators/resource_helpers.rb index d6ccfc496a..de01c858dd 100644 --- a/railties/lib/rails/generators/resource_helpers.rb +++ b/railties/lib/rails/generators/resource_helpers.rb @@ -53,7 +53,7 @@ module Rails @controller_i18n_scope ||= controller_file_path.gsub('/', '.') end - # Loads the ORM::Generators::ActiveModel class. This class is responsable + # Loads the ORM::Generators::ActiveModel class. This class is responsible # to tell scaffold entities how to generate an specific method for the # ORM. Check Rails::Generators::ActiveModel for more information. def orm_class diff --git a/railties/lib/rails/railtie/configuration.rb b/railties/lib/rails/railtie/configuration.rb index afeceafb67..e4368866a1 100644 --- a/railties/lib/rails/railtie/configuration.rb +++ b/railties/lib/rails/railtie/configuration.rb @@ -18,7 +18,7 @@ module Rails # This allows you to modify application's generators from Railties. # - # Values set on app_generators will become defaults for applicaiton, unless + # Values set on app_generators will become defaults for application, unless # application overwrites them. def app_generators @@app_generators ||= Rails::Configuration::Generators.new -- cgit v1.2.3 From f6a5449d431e5d9096edbf4cb52eb2d82f467925 Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Sat, 5 Mar 2011 11:29:57 +0100 Subject: copy-edits 819762c * simplifies some sentences * use a more neutral language with less you/yours --- railties/guides/source/contributing_to_ruby_on_rails.textile | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'railties') diff --git a/railties/guides/source/contributing_to_ruby_on_rails.textile b/railties/guides/source/contributing_to_ruby_on_rails.textile index 9739da2666..3454b8b7a3 100644 --- a/railties/guides/source/contributing_to_ruby_on_rails.textile +++ b/railties/guides/source/contributing_to_ruby_on_rails.textile @@ -349,22 +349,21 @@ $ git commit -a $ 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. +Open the diff file in your text editor of choice to sanity check the results, and make sure that no unintended changes crept in. -You can check your patches by applying your patch to an different dedicated branch: +You can also perform an extra check by applying the patch to a 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: +Please make sure the patch does not introduce whitespace errors: $ 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