From 210ebd362308a6964797a898fab9a5de35da1dab Mon Sep 17 00:00:00 2001 From: Paul Morganthall Date: Thu, 5 May 2011 09:05:40 -0700 Subject: Rails 3 requires the "new" command to create a new project. --- railties/guides/source/testing.textile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'railties') diff --git a/railties/guides/source/testing.textile b/railties/guides/source/testing.textile index efa2bbdca6..061d597ae1 100644 --- a/railties/guides/source/testing.textile +++ b/railties/guides/source/testing.textile @@ -38,7 +38,7 @@ When you do end up destroying your testing database (and it will happen, trust m h4. Rails Sets up for Testing from the Word Go -Rails creates a +test+ folder for you as soon as you create a Rails project using +rails _application_name_+. If you list the contents of this folder then you shall see: +Rails creates a +test+ folder for you as soon as you create a Rails project using +rails new _application_name_+. If you list the contents of this folder then you shall see: $ ls -F test/ -- cgit v1.2.3 From 0f7827ca3489e73855f8cb9e9aa25efc1435d059 Mon Sep 17 00:00:00 2001 From: Jason Voegele Date: Thu, 5 May 2011 09:22:03 -0700 Subject: Added info on using Ehcache as cache store. --- railties/guides/source/caching_with_rails.textile | 31 ++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) (limited to 'railties') diff --git a/railties/guides/source/caching_with_rails.textile b/railties/guides/source/caching_with_rails.textile index 799339e674..91827fd493 100644 --- a/railties/guides/source/caching_with_rails.textile +++ b/railties/guides/source/caching_with_rails.textile @@ -98,7 +98,7 @@ You can also use +:if+ (or +:unless+) to pass a Proc that specifies when the act You can modify the default action cache path by passing a +:cache_path+ option. This will be passed directly to +ActionCachePath.path_for+. This is handy for actions with multiple possible routes that should be cached differently. If a block is given, it is called with the current controller instance. -Finally, if you are using memcached, you can also pass +:expires_in+. In fact, all parameters not used by +caches_action+ are sent to the underlying cache store. +Finally, if you are using memcached or Ehcache, you can also pass +:expires_in+. In fact, all parameters not used by +caches_action+ are sent to the underlying cache store. INFO: Action caching runs in an after filter. Thus, invalid requests won't generate spurious cache entries as long as you halt them. Typically, a redirection in some before filter that checks request preconditions does the job. @@ -304,6 +304,35 @@ The +write+ and +fetch+ methods on this cache accept two additional options that ActionController::Base.cache_store = :mem_cache_store, "cache-1.example.com", "cache-2.example.com" +h4. ActiveSupport::Cache::EhcacheStore + +If you are using JRuby you can use Terracotta's Ehcache as the cache store for your application. Ehcache is an open source Java cache that also offers an enterprise version with increased scalability, management, and commercial support. You must first install the jruby-ehcache-rails3 gem (version 1.1.0 or later) to use this cache store. + + +ActionController::Base.cache_store = :ehcache_store + + +When initializing the cache, you may use the +:ehcache_config+ option to specify the Ehcache config file to use (where the default is "ehcache.xml" in your Rails config directory), and the :cache_name option to provide a custom name for your cache (the default is rails_cache). + +In addition to the standard +:expires_in+ option, the +write+ method on this cache can also accept the additional +:unless_exist+ option, which will cause the cache store to use Ehcache's +putIfAbsent+ method instead of +put+, and therefore will not overwrite an existing entry. Additionally, the +write+ method supports all of the properties exposed by the "Ehcache Element class":http://ehcache.org/apidocs/net/sf/ehcache/Element.html , including: + +|_. Property |_. Argument Type |_. Description | +| elementEvictionData | ElementEvictionData | Sets this element's eviction data instance. | +| eternal | boolean | Sets whether the element is eternal. | +| timeToIdle, tti | int | Sets time to idle | +| timeToLive, ttl, expires_in | int | Sets time to Live | +| version | long | Sets the version attribute of the ElementAttributes object. | + +These options are passed to the +write+ method as Hash options using either camelCase or underscore notation, as in the following examples: + + +Rails.cache.write('key', 'value', :time_to_idle => 60.seconds, :timeToLive => 600.seconds) +caches_action :index, :expires_in => 60.seconds, :unless_exist => true + + +For more information about Ehcache, see "http://ehcache.org/":http://ehcache.org/ . +For more information about Ehcache for JRuby and Rails, see "http://ehcache.org/documentation/jruby.html":http://ehcache.org/documentation/jruby.html + h4. Custom Cache Stores You can create your own custom cache store by simply extending +ActiveSupport::Cache::Store+ and implementing the appropriate methods. In this way, you can swap in any number of caching technologies into your Rails application. -- cgit v1.2.3 From 6df7a223caa7b68543595afcebb5700435bfb4ec Mon Sep 17 00:00:00 2001 From: Paul Morganthall Date: Thu, 5 May 2011 12:19:01 -0700 Subject: Restore emphasis on 'application name'. --- railties/guides/source/testing.textile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'railties') diff --git a/railties/guides/source/testing.textile b/railties/guides/source/testing.textile index 061d597ae1..01badebd41 100644 --- a/railties/guides/source/testing.textile +++ b/railties/guides/source/testing.textile @@ -38,7 +38,7 @@ When you do end up destroying your testing database (and it will happen, trust m h4. Rails Sets up for Testing from the Word Go -Rails creates a +test+ folder for you as soon as you create a Rails project using +rails new _application_name_+. If you list the contents of this folder then you shall see: +Rails creates a +test+ folder for you as soon as you create a Rails project using +rails new+ _application_name_. If you list the contents of this folder then you shall see: $ ls -F test/ -- cgit v1.2.3 From 5e235278c479b9060f8dd1eb32a1abd0894b7070 Mon Sep 17 00:00:00 2001 From: Aditya Sanghi Date: Fri, 6 May 2011 13:07:14 -0700 Subject: Made language consistent with the rest of the comments in the file. --- railties/lib/rails/generators/base.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'railties') diff --git a/railties/lib/rails/generators/base.rb b/railties/lib/rails/generators/base.rb index 8d03cb911b..1f6a7a2f59 100644 --- a/railties/lib/rails/generators/base.rb +++ b/railties/lib/rails/generators/base.rb @@ -117,8 +117,8 @@ module Rails # # ==== Switches # - # All hooks come with switches for user interface. If the user don't want - # to use any test framework, he can do: + # All hooks come with switches for user interface. If you do not want + # to use any test framework, you can do: # # rails generate controller Account --skip-test-framework # -- cgit v1.2.3 From e35ba99e4b305d347de8737b6c2fcbd9b7ce6b02 Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Sat, 7 May 2011 22:37:56 +0530 Subject: remove unnecessary use of 'Example' --- railties/guides/source/rails_on_rack.textile | 6 ------ 1 file changed, 6 deletions(-) (limited to 'railties') diff --git a/railties/guides/source/rails_on_rack.textile b/railties/guides/source/rails_on_rack.textile index b1db2942dd..aa53aa6db6 100644 --- a/railties/guides/source/rails_on_rack.textile +++ b/railties/guides/source/rails_on_rack.textile @@ -117,8 +117,6 @@ You can add a new middleware to the middleware stack using any of the following * +config.middleware.insert_after(existing_middleware, new_middleware, args)+ - Adds the new middleware after the specified existing middleware in the middleware stack. -Example: - # config/environment.rb @@ -134,8 +132,6 @@ h5. Swapping a Middleware You can swap an existing middleware in the middleware stack using +config.middleware.swap+. -Example: - # config/environment.rb @@ -173,8 +169,6 @@ h4. Customizing Internal Middleware Stack It's possible to replace the entire middleware stack with a custom stack using +ActionController::Dispatcher.middleware=+. -Example: - Put the following in an initializer: -- cgit v1.2.3 From 197f3f07d6bd4fbd8e8a877e29fbad8aefba9c71 Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Sun, 8 May 2011 15:12:18 +0530 Subject: Included more details on Rails coding conventions (from LH Source Style page) --- .../guides/source/contributing_to_ruby_on_rails.textile | 14 ++++++++++---- 1 file changed, 10 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 cb09b180a2..1f757eaeb2 100644 --- a/railties/guides/source/contributing_to_ruby_on_rails.textile +++ b/railties/guides/source/contributing_to_ruby_on_rails.textile @@ -300,10 +300,16 @@ h4. Follow the Coding Conventions Rails follows a simple set of coding style conventions. -* Two spaces, no tabs -* Prefer +&&+/+||+ over +and+/+or+ -* +MyClass.my_method(my_arg)+ not +my_method( my_arg )+ or +my_method my_arg+ -* Follow the conventions you see used in the source already +* Two spaces, no tabs. +* No trailing whitespace. Blank lines should not have any space. +* Indent after private/protected. +* Prefer +&&+/+||+ over +and+/+or+. +* Prefer class << self block over self.method for class methods. +* +MyClass.my_method(my_arg)+ not +my_method( my_arg )+ or +my_method my_arg+. +* a = b and not a=b. +* Follow the conventions you see used in the source already. + +These are some guidelines and please use your best judgement in using them. h4. Sanity Check -- cgit v1.2.3 From 668cb42f94f8fdf4a999ceecaaa2d331612637d9 Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Mon, 9 May 2011 00:02:27 +0530 Subject: improve comment in wrap_parameters template --- .../rails/app/templates/config/initializers/wrap_parameters.rb.tt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'railties') diff --git a/railties/lib/rails/generators/rails/app/templates/config/initializers/wrap_parameters.rb.tt b/railties/lib/rails/generators/rails/app/templates/config/initializers/wrap_parameters.rb.tt index 60137ed2bb..32ffbee7a1 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/initializers/wrap_parameters.rb.tt +++ b/railties/lib/rails/generators/rails/app/templates/config/initializers/wrap_parameters.rb.tt @@ -3,7 +3,7 @@ # This file contains the settings for ActionController::ParametersWrapper # which will be enabled by default in the upcoming version of Ruby on Rails. -# Enable parameter wrapping for JSON. You can disable this by set :format to empty array. +# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. ActionController::Base.wrap_parameters :format => [:json] # Disable root element in JSON by default. -- cgit v1.2.3 From d6ff2eea0b66df825105aa7b74a32db7fd3db8b9 Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Mon, 9 May 2011 00:30:14 +0530 Subject: Include examples for negative ordinalize in the guide --- 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 f2170e120b..8f98c71aa0 100644 --- a/railties/guides/source/active_support_core_extensions.textile +++ b/railties/guides/source/active_support_core_extensions.textile @@ -1833,6 +1833,8 @@ The method +ordinalize+ returns the ordinal string corresponding to the receiver 2.ordinalize # => "2nd" 53.ordinalize # => "53rd" 2009.ordinalize # => "2009th" +-21.ordinalize # => "-21st" +-134.ordinalize # => "-134th" NOTE: Defined in +active_support/core_ext/integer/inflections.rb+. -- cgit v1.2.3 From fda9c7d0c872fcb75e24ae8479bb6c0a34d65e70 Mon Sep 17 00:00:00 2001 From: Sasha Gerrand Date: Mon, 9 May 2011 12:20:44 +1000 Subject: - Moved foreign key parameter to correct location for self join on a model example --- railties/guides/source/association_basics.textile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'railties') diff --git a/railties/guides/source/association_basics.textile b/railties/guides/source/association_basics.textile index 94dce1b97b..43babb8b52 100644 --- a/railties/guides/source/association_basics.textile +++ b/railties/guides/source/association_basics.textile @@ -342,9 +342,9 @@ In designing a data model, you will sometimes find a model that should have a re class Employee < ActiveRecord::Base - has_many :subordinates, :class_name => "Employee", - :foreign_key => "manager_id" + has_many :subordinates, :class_name => "Employee" belongs_to :manager, :class_name => "Employee" + :foreign_key => "manager_id" end -- cgit v1.2.3 From e0fdbfd33a36cb6836997392465775f68125d598 Mon Sep 17 00:00:00 2001 From: Sasha Gerrand Date: Mon, 9 May 2011 12:23:24 +1000 Subject: - Fixed typo in the example of a self join on a model --- railties/guides/source/association_basics.textile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'railties') diff --git a/railties/guides/source/association_basics.textile b/railties/guides/source/association_basics.textile index 43babb8b52..e59a30624e 100644 --- a/railties/guides/source/association_basics.textile +++ b/railties/guides/source/association_basics.textile @@ -342,7 +342,7 @@ In designing a data model, you will sometimes find a model that should have a re class Employee < ActiveRecord::Base - has_many :subordinates, :class_name => "Employee" + has_many :subordinates, :class_name => "Employee", belongs_to :manager, :class_name => "Employee" :foreign_key => "manager_id" end -- cgit v1.2.3 From b97e6300ef5c89efdb75a00daa93f449f31c4562 Mon Sep 17 00:00:00 2001 From: Sasha Gerrand Date: Mon, 9 May 2011 18:14:44 +1000 Subject: - Fixed typo in association parameters configuration (again) --- railties/guides/source/association_basics.textile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'railties') diff --git a/railties/guides/source/association_basics.textile b/railties/guides/source/association_basics.textile index e59a30624e..458bfefad8 100644 --- a/railties/guides/source/association_basics.textile +++ b/railties/guides/source/association_basics.textile @@ -342,8 +342,8 @@ In designing a data model, you will sometimes find a model that should have a re class Employee < ActiveRecord::Base - has_many :subordinates, :class_name => "Employee", - belongs_to :manager, :class_name => "Employee" + has_many :subordinates, :class_name => "Employee" + belongs_to :manager, :class_name => "Employee", :foreign_key => "manager_id" end -- cgit v1.2.3 From 21be7f20e782292c083563f059a527d09898f75a Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Tue, 10 May 2011 00:08:38 +0530 Subject: fixes github fork url --- railties/guides/source/contributing_to_ruby_on_rails.textile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (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 1f757eaeb2..fecc7b5e43 100644 --- a/railties/guides/source/contributing_to_ruby_on_rails.textile +++ b/railties/guides/source/contributing_to_ruby_on_rails.textile @@ -350,7 +350,7 @@ Navigate to the Rails "GitHub repository":https://github.com/rails/rails and pre Add the new remote to your local repository on your local machine: -$ git remote add mine https://<your user name>@github.com/<your user name>/rails.git +$ git remote add mine https://@github.com//rails.git Push to your remote: -- cgit v1.2.3 From 973c6e243535ccb731d8984194f8269e6308ea83 Mon Sep 17 00:00:00 2001 From: Trent Ogren Date: Tue, 10 May 2011 08:08:20 -0700 Subject: typo fix --- railties/lib/rails/generators/rails/assets/USAGE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'railties') diff --git a/railties/lib/rails/generators/rails/assets/USAGE b/railties/lib/rails/generators/rails/assets/USAGE index adebfd7e6f..e219fdc7d7 100644 --- a/railties/lib/rails/generators/rails/assets/USAGE +++ b/railties/lib/rails/generators/rails/assets/USAGE @@ -1,5 +1,5 @@ Description: - Stubs out a new asset placeholders. Pass the asset name, either CamelCased + Stubs out new asset placeholders. Pass the asset name, either CamelCased or under_scored. To create assets within a folder, specify the assets name as a -- cgit v1.2.3 From 8ce2844cbb52ea31716b0f286b5d7f9d20bf0e3c Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Tue, 10 May 2011 21:19:47 +0530 Subject: minor fix in assets usage --- railties/lib/rails/generators/rails/assets/USAGE | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'railties') diff --git a/railties/lib/rails/generators/rails/assets/USAGE b/railties/lib/rails/generators/rails/assets/USAGE index e219fdc7d7..c5375cdc06 100644 --- a/railties/lib/rails/generators/rails/assets/USAGE +++ b/railties/lib/rails/generators/rails/assets/USAGE @@ -2,7 +2,7 @@ Description: Stubs out new asset placeholders. Pass the asset name, either CamelCased or under_scored. - To create assets within a folder, specify the assets name as a + To create an asset within a folder, specify the asset's name as a path like 'parent/name'. This generates a JavaScript stub in app/assets/javascripts and a stylesheet @@ -15,6 +15,6 @@ Example: `rails generate assets posts` Posts assets. - Javascript: app/assets/javascripts/posts.js + JavaScript: app/assets/javascripts/posts.js Stylesheet: app/assets/stylesheets/posts.css -- cgit v1.2.3 From d10a1b5739730425fc5a103f8fd7eb15b6e34db8 Mon Sep 17 00:00:00 2001 From: Dan Pickett Date: Tue, 10 May 2011 20:55:59 -0400 Subject: fix bad encoding on contributing to RoR page --- railties/guides/source/contributing_to_ruby_on_rails.textile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (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 fecc7b5e43..a48355a833 100644 --- a/railties/guides/source/contributing_to_ruby_on_rails.textile +++ b/railties/guides/source/contributing_to_ruby_on_rails.textile @@ -361,7 +361,7 @@ $ git push mine master h4. Issue a Pull Request -Navigate to the Rails repository you just pushed to (e.g. https://github.com/<your user name>/rails) and press "Pull Request" in the upper right hand corner. +Navigate to the Rails repository you just pushed to (e.g. https://github.com//rails) and press "Pull Request" in the upper right hand corner. Ensure the changesets you introduced are included in the "Commits" tab and that the "Files Changed" incorporate all of your changes. -- cgit v1.2.3 From e80e36c194cbeb068e11e90a4b0ffd75299677a5 Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Wed, 11 May 2011 22:50:10 +0530 Subject: indentation fixes --- railties/guides/source/generators.textile | 47 +++++++++++++++---------------- 1 file changed, 23 insertions(+), 24 deletions(-) (limited to 'railties') diff --git a/railties/guides/source/generators.textile b/railties/guides/source/generators.textile index ac709968d9..a3181b9ac5 100644 --- a/railties/guides/source/generators.textile +++ b/railties/guides/source/generators.textile @@ -111,7 +111,6 @@ In order to understand what a generator template means, let's create the file +l # Add initialization content here - And now let's change the generator to copy this template when invoked: @@ -286,8 +285,8 @@ end Now, when the helper generator is invoked and TestUnit is configured as the test framework, it will try to invoke both +Rails::TestUnitGenerator+ and +TestUnit::MyHelperGenerator+. Since none of those are defined, we can tell our generator to invoke +TestUnit::Generators::HelperGenerator+ instead, which is defined since it's a Rails generator. To do that, we just need to add: - # Search for :helper instead of :my_helper - hook_for :test_framework, :as => :helper +# Search for :helper instead of :my_helper +hook_for :test_framework, :as => :helper And now you can re-run scaffold for another resource and see it generating tests as well! @@ -412,7 +411,7 @@ h4. +plugin+ +plugin+ will install a plugin into the current application. - plugin("dynamic-form", :git => "git://github.com/rails/dynamic-form.git") +plugin("dynamic-form", :git => "git://github.com/rails/dynamic-form.git") Available options are: @@ -441,13 +440,13 @@ Available options are: Any additional options passed to this method are put on the end of the line: - gem("devise", :git => "git://github.com/plataformatec/devise", :branch => "master") +gem("devise", :git => "git://github.com/plataformatec/devise", :branch => "master") The above code will put the following line into +Gemfile+: - gem "devise", :git => "git://github.com/plataformatec/devise", :branch => "master" +gem "devise", :git => "git://github.com/plataformatec/devise", :branch => "master" @@ -456,7 +455,7 @@ h4. +add_source+ Adds a specified source to +Gemfile+: - add_source "http://gems.github.com" +add_source "http://gems.github.com" h4. +application+ @@ -464,7 +463,7 @@ h4. +application+ Adds a line to +config/application.rb+ directly after the application class definition. - application "config.asset_host = 'http://example.com'" +application "config.asset_host = 'http://example.com'" This method can also take a block: @@ -490,10 +489,10 @@ h4. +git+ Runs the specified git command: - git :init - git :add => "." - git :commit => "-m First commit!" - git :add => "onefile.rb", :rm => "badfile.cxx" +git :init +git :add => "." +git :commit => "-m First commit!" +git :add => "onefile.rb", :rm => "badfile.cxx" The values of the hash here being the arguments or options passed to the specific git command. As per the final example shown here, multiple git commands can be specified at a time, but the order of their running is not guaranteed to be the same as the order that they were specified in. @@ -503,15 +502,15 @@ h4. +vendor+ Places a file into +vendor+ which contains the specified code. - vendor("sekrit.rb", '#top secret stuff') +vendor("sekrit.rb", '#top secret stuff') This method also takes a block: - vendor("seeds.rb") do - "puts 'in ur app, seeding ur database'" - end +vendor("seeds.rb") do + "puts 'in ur app, seeding ur database'" +end h4. +lib+ @@ -519,7 +518,7 @@ h4. +lib+ Places a file into +lib+ which contains the specified code. - lib("special.rb", 'p Rails.root') +lib("special.rb", 'p Rails.root') This method also takes a block: @@ -535,7 +534,7 @@ h4. +rakefile+ Creates a Rake file in the +lib/tasks+ directory of the application. - rakefile("test.rake", 'hello there') +rakefile("test.rake", 'hello there') This method also takes a block: @@ -555,7 +554,7 @@ h4. +initializer+ Creates an initializer in the +config/initializers+ directory of the application: - initializer("begin.rb", "puts 'this is the beginning'") +initializer("begin.rb", "puts 'this is the beginning'") This method also takes a block: @@ -571,7 +570,7 @@ h4. +generate+ Runs the specified generator where the first argument is the generator name and the remaining arguments are passed directly to the generator. - generate("scaffold", "forums title:string description:text") +generate("scaffold", "forums title:string description:text") @@ -580,7 +579,7 @@ h4. +rake+ Runs the specified Rake task. - rake("db:migrate") +rake("db:migrate") Available options are: @@ -593,7 +592,7 @@ h4. +capify!+ Runs the +capify+ command from Capistrano at the root of the application which generates Capistrano configuration. - capify! +capify! h4. +route+ @@ -601,7 +600,7 @@ h4. +route+ Adds text to the +config/routes.rb+ file: - route("resources :people") +route("resources :people") h4. +readme+ @@ -609,7 +608,7 @@ h4. +readme+ Output the contents of a file in the template's +source_path+, usually a README. - readme("README") +readme("README") h3. Changelog -- cgit v1.2.3 From a117ac431ad3624d047f84f0860c301a844f55c9 Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Wed, 11 May 2011 23:10:20 +0530 Subject: fix spellings --- railties/lib/rails/generators/rails/app/app_generator.rb | 2 +- .../generators/rails/app/templates/config/environments/production.rb.tt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'railties') diff --git a/railties/lib/rails/generators/rails/app/app_generator.rb b/railties/lib/rails/generators/rails/app/app_generator.rb index d79f76c799..6562667782 100644 --- a/railties/lib/rails/generators/rails/app/app_generator.rb +++ b/railties/lib/rails/generators/rails/app/app_generator.rb @@ -21,7 +21,7 @@ module Rails # generator. # # This allows you to override entire operations, like the creation of the - # Gemfile, README, or javascript files, without needing to know exactly + # Gemfile, README, or JavaScript files, without needing to know exactly # what those operations do so you can create another template action. class AppBuilder def rakefile diff --git a/railties/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt b/railties/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt index 9553f3bdde..1c3dc1117f 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt +++ b/railties/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt @@ -31,7 +31,7 @@ # Use a different cache store in production # config.cache_store = :mem_cache_store - # Enable serving of images, stylesheets, and javascripts from an asset server + # Enable serving of images, stylesheets, and JavaScripts from an asset server # config.action_controller.asset_host = "http://assets.example.com" # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added) -- cgit v1.2.3 From deea8ca727179ceb134c59bab4945cf6f7290fab Mon Sep 17 00:00:00 2001 From: Guillermo Iguaran Date: Thu, 12 May 2011 19:58:05 -0500 Subject: Prefer topic branches instead of master branch for users contributions --- .../guides/source/contributing_to_ruby_on_rails.textile | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 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 a48355a833..5eb925d7d2 100644 --- a/railties/guides/source/contributing_to_ruby_on_rails.textile +++ b/railties/guides/source/contributing_to_ruby_on_rails.textile @@ -232,11 +232,11 @@ You can also help out by examining pull requests that have been submitted to Rub $ git checkout -b testing_branch -Then you can use their remote branch to update your codebase. For example, let's say the GitHub user JohnSmith has forked and pushed to the master branch located at https://github.com/JohnSmith/rails. +Then you can use their remote branch to update your codebase. For example, let's say the GitHub user JohnSmith has forked and pushed to the topic branch located at https://github.com/JohnSmith/rails. $ git remote add JohnSmith git://github.com/JohnSmith/rails.git -$ git pull JohnSmith master +$ git pull JohnSmith topic After applying their branch, test it out! Here are some things to think about: @@ -356,14 +356,16 @@ $ git remote add mine https://@github.com//rails Push to your remote: -$ git push mine master +$ git push mine my_new_branch h4. Issue a Pull Request Navigate to the Rails repository you just pushed to (e.g. https://github.com//rails) and press "Pull Request" in the upper right hand corner. - -Ensure the changesets you introduced are included in the "Commits" tab and that the "Files Changed" incorporate all of your changes. + +Write your branch name in branch field (is filled with master by default) and press "Update Commit Range" + +Ensure the changesets you introduced are included in the "Commits" tab and that the "Files Changed" incorporate all of your changes. Fill in some details about your potential patch including a meaningful title. When finished, press "Send pull request." Rails Core will be notified about your submission. @@ -383,6 +385,7 @@ All contributions, either via master or docrails, get credit in "Rails Contribut h3. Changelog +* May 12, 2011: Modified to prefer topic branches instead of master branch for users contributions by "Guillermo Iguaran":http://quillarb.org * April 29, 2011: Reflect GitHub Issues and Pull Request workflow by "Dan Pickett":http://www.enlightsolutions.com * April 14, 2011: Modified Contributing to the Rails Code section to add '[#ticket_number state:commited]' on patches commit messages by "Sebastian Martinez":http://wyeworks.com * December 28, 2010: Complete revision by "Xavier Noria":credits.html#fxn -- cgit v1.2.3 From 50639c97eb326a16f35f94e56e57aff4a4985003 Mon Sep 17 00:00:00 2001 From: Prem Sichanugrist Date: Fri, 13 May 2011 14:31:09 -0400 Subject: Adding guide for wrapping JSON/XML parameters, which also links to the API documentation. Note that it currently links to http://edgeapi.rubyonrails.org because it's Rails 3.1 feature. --- .../source/action_controller_overview.textile | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'railties') diff --git a/railties/guides/source/action_controller_overview.textile b/railties/guides/source/action_controller_overview.textile index 3a1a4ee66e..7ace6e6fdc 100644 --- a/railties/guides/source/action_controller_overview.textile +++ b/railties/guides/source/action_controller_overview.textile @@ -110,6 +110,32 @@ When this form is submitted, the value of +params[:client]+ will be {"name" Note that the +params+ hash is actually an instance of +HashWithIndifferentAccess+ from Active Support, which acts like a hash that lets you use symbols and strings interchangeably as keys. +h4. JSON/XML parameters + +If you're writing a web service application, you might find yourself more comfortable on accepting parameters in JSON or XML format. Rails will automatically convert your parameters into +params+ hash, which you'll be able to access it like you would normally do with form data. + +So for example, if you sending this JSON parameter: + +
+{ "company": { "name": "acme", "address": "123 Carrot Street" }}
+
+ +You'll get +params[:company]+ as +{ :name => "acme", "address" => "123 Carrot Street" }+. + +Also, if you've turned on +config.wrap_parameters+ in your initializer or calling +wrap_parameters+ in your controller, you can safely omit the root element in the JSON/XML parameter. The parameters will be cloned and wrapped in the key according to your controller's name by default. So the above parameter can be written as: + +
+{ "name": "acme", "address": "123 Carrot Street" }
+
+ +And assume that you're sending the data to +CompaniesController+, it would then be wrapped in +:company+ key like this: + + +{ :name => "acme", :address => "123 Carrot Street", :company => { :name => "acme", :address => "123 Carrot Street" }} + + +You can customize the name of the key or specific parameters you want to wrap by consulting the "API documentation":http://edgeapi.rubyonrails.org/classes/ActionController/ParamsWrapper.html" + h4. Routing Parameters The +params+ hash will always contain the +:controller+ and +:action+ keys, but you should use the methods +controller_name+ and +action_name+ instead to access these values. Any other parameters defined by the routing, such as +:id+ will also be available. As an example, consider a listing of clients where the list can show either active or inactive clients. We can add a route which captures the +:status+ parameter in a "pretty" URL: -- cgit v1.2.3 From 4ef4d5771950e31de43b8b8ae0389f2807f149bd Mon Sep 17 00:00:00 2001 From: Prem Sichanugrist Date: Fri, 13 May 2011 15:13:40 -0400 Subject: Link the API documentation to non-edge instead --- railties/guides/source/action_controller_overview.textile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'railties') diff --git a/railties/guides/source/action_controller_overview.textile b/railties/guides/source/action_controller_overview.textile index 7ace6e6fdc..2306165f2d 100644 --- a/railties/guides/source/action_controller_overview.textile +++ b/railties/guides/source/action_controller_overview.textile @@ -134,7 +134,7 @@ And assume that you're sending the data to +CompaniesController+, it would then { :name => "acme", :address => "123 Carrot Street", :company => { :name => "acme", :address => "123 Carrot Street" }} -You can customize the name of the key or specific parameters you want to wrap by consulting the "API documentation":http://edgeapi.rubyonrails.org/classes/ActionController/ParamsWrapper.html" +You can customize the name of the key or specific parameters you want to wrap by consulting the "API documentation":http://api.rubyonrails.org/classes/ActionController/ParamsWrapper.html" h4. Routing Parameters -- cgit v1.2.3 From 159e605d1935671d9997bb717dd508dcbf53b506 Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Sat, 14 May 2011 00:51:54 +0530 Subject: minor corrections --- railties/guides/source/action_controller_overview.textile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'railties') diff --git a/railties/guides/source/action_controller_overview.textile b/railties/guides/source/action_controller_overview.textile index 2306165f2d..891bae3d5e 100644 --- a/railties/guides/source/action_controller_overview.textile +++ b/railties/guides/source/action_controller_overview.textile @@ -112,15 +112,15 @@ Note that the +params+ hash is actually an instance of +HashWithIndifferentAcces h4. JSON/XML parameters -If you're writing a web service application, you might find yourself more comfortable on accepting parameters in JSON or XML format. Rails will automatically convert your parameters into +params+ hash, which you'll be able to access it like you would normally do with form data. +If you're writing a web service application, you might find yourself more comfortable on accepting parameters in JSON or XML format. Rails will automatically convert your parameters into +params+ hash, which you'll be able to access like you would normally do with form data. -So for example, if you sending this JSON parameter: +So for example, if you are sending this JSON parameter:
-{ "company": { "name": "acme", "address": "123 Carrot Street" }}
+{ "company": { "name": "acme", "address": "123 Carrot Street" } }
 
-You'll get +params[:company]+ as +{ :name => "acme", "address" => "123 Carrot Street" }+. +You'll get params[:company] as { :name => "acme", "address" => "123 Carrot Street" }. Also, if you've turned on +config.wrap_parameters+ in your initializer or calling +wrap_parameters+ in your controller, you can safely omit the root element in the JSON/XML parameter. The parameters will be cloned and wrapped in the key according to your controller's name by default. So the above parameter can be written as: @@ -134,7 +134,7 @@ And assume that you're sending the data to +CompaniesController+, it would then { :name => "acme", :address => "123 Carrot Street", :company => { :name => "acme", :address => "123 Carrot Street" }} -You can customize the name of the key or specific parameters you want to wrap by consulting the "API documentation":http://api.rubyonrails.org/classes/ActionController/ParamsWrapper.html" +You can customize the name of the key or specific parameters you want to wrap by consulting the "API documentation":http://api.rubyonrails.org/classes/ActionController/ParamsWrapper.html h4. Routing Parameters -- cgit v1.2.3 From 47003f8cdf7afbfa1d78939f17d8b49c9c4348f7 Mon Sep 17 00:00:00 2001 From: Karel Minarik Date: Sat, 14 May 2011 09:03:30 +0200 Subject: [GUIDES] Changed the `LANGUAGE` variable to `GUIDES_LANGUAGE` to minimize conflicts with regular environment variables (eg. in Ubuntu) --- railties/guides/rails_guides/generator.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'railties') diff --git a/railties/guides/rails_guides/generator.rb b/railties/guides/rails_guides/generator.rb index 154355cac1..14d671c8f3 100644 --- a/railties/guides/rails_guides/generator.rb +++ b/railties/guides/rails_guides/generator.rb @@ -38,9 +38,10 @@ # Note that if you are working on a guide generation will by default process # only that one, so ONLY is rarely used nowadays. # -# LANGUAGE -# Use LANGUAGE when you want to generate translated guides in source/ -# folder (such as source/es). Ignore it when generating English guides. +# GUIDES_LANGUAGE +# Use GUIDES_LANGUAGE when you want to generate translated guides in +# source/ folder (such as source/es). +# Ignore it when generating English guides. # # EDGE # Set to "1" to indicate generated guides should be marked as edge. This @@ -67,7 +68,7 @@ module RailsGuides GUIDES_RE = /\.(?:textile|html\.erb)$/ def initialize(output=nil) - @lang = ENV['LANGUAGE'] + @lang = ENV['GUIDES_LANGUAGE'] initialize_dirs(output) create_output_dir_if_needed set_flags_from_environment -- cgit v1.2.3